pure-lua cratera-to-lua converter
Go to file
SoniEx2 4b365cdab1 It... kinda works? 2019-07-30 21:12:16 -03:00
LICENSE.txt Parser seems to work? 2019-03-31 11:02:57 -03:00
README.md Add anti-LPeg rationale 2019-04-11 13:49:31 -03:00
autotest.sh Add stuff that doesn't work 2019-04-15 22:38:40 -03:00
compiler.lua It... kinda works? 2019-07-30 21:12:16 -03:00
cratera.lua It... kinda works? 2019-07-30 21:12:16 -03:00
dirtycompiler.lua It... kinda works? 2019-07-30 21:12:16 -03:00
dirtycratera.lua It... kinda works? 2019-07-30 21:12:16 -03:00
luatokens.lua It... kinda works? 2019-07-30 21:12:16 -03:00
parser.lua It... kinda works? 2019-07-30 21:12:16 -03:00
printtokens.lua Add stuff that doesn't work 2019-04-15 22:38:40 -03:00
testc.lua It... kinda works? 2019-07-30 21:12:16 -03:00
testp.lua Add stuff that doesn't work 2019-04-15 22:38:40 -03:00
tests.cratera It... kinda works? 2019-07-30 21:12:16 -03:00

README.md

The Cratera Programming Language (and support components)

This repo contains the Cratera to Lua compiler, as well as support components for the Cratera to Lua compiler, namely a pure-Lua Lua tokenizer and a table-based parser thing.

Cratera is a language very similar to Lua, and as such most of the Lua manual applies to it. Additionally, it supports the following syntax sugar, called "traits":

mytable:[mytrait].myfunction(myargument)

which is equivalent to:

mytable[mytrait].myfunction(mytable, myargument)

This syntax sugar is similar to the "methods" syntax sugar (Lua 5.3 §3.4.10, Lua 5.2 §3.4.9, Lua 5.1 §2.5.8), and, indeed, mytable is only evaluated once.

Why not use LPeg?

The use of a custom parsing library boils down to two reasons:

  1. LPeg can't stream or produce partial outputs. This just makes it difficult to use for making a compiler.
  2. LPeg can't process tables. It's still possible to use LPeg to parse table-based structures, but one must serialize them beforehand, which is... far from ideal, to say the least.