pure-lua cratera-to-lua converter
Go to file
SoniEx2 e5e6533401 Add anti-LPeg rationale 2019-04-11 13:49:31 -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
luatokens.lua Fix number parsing (not compatible with 5.1) 2019-04-09 16:35:05 -03:00
parser.lua Allow parser.lua to be used as an argument parser 2019-04-10 19:41:50 -03:00
printtokens.lua Fix -- 2019-04-10 19:44:38 -03:00
test.lua Tests pass in Lua 5.1/5.2 now too 2019-04-09 16:37:54 -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.