pure-lua cratera-to-lua converter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SoniEx2 5aa22fbbb1 Full cratera support 2 weeks ago
LICENSE.txt Parser seems to work? 4 months ago
README.md Add anti-LPeg rationale 4 months ago
autotest.sh Add stuff that doesn't work 4 months ago
compiler.lua It... kinda works? 2 weeks ago
cratera.lua It... kinda works? 2 weeks ago
dirtycompiler.lua Full cratera support 2 weeks ago
dirtycratera.lua It... kinda works? 2 weeks ago
luatokens.lua It... kinda works? 2 weeks ago
parser.lua It... kinda works? 2 weeks ago
printtokens.lua Add stuff that doesn't work 4 months ago
testc.lua It... kinda works? 2 weeks ago
testp.lua Add stuff that doesn't work 4 months ago
tests.cratera Full cratera support 2 weeks ago

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.