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":
which is equivalent to:
Why not use LPeg?
The use of a custom parsing library boils down to two reasons:
- LPeg can't stream or produce partial outputs. This just makes it difficult to use for making a compiler.
- 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.