- samples:
- samples/hello_world.lua: simple example, with some meta-stages.
- samples/clist_test.lua: list syntax extensions sample.
- samples/pythonic.lua: lexer extension which makes indentation significant, a la Python.
- samples/pysample.lua: sample using the pythonic lexer extension.
- samples/metaloop.lua: interactive REPL loop for Metalua. Can use libedit C library if available.
- samples/continue.lua: usage example of the "continue" extension.
- samples/lazysieve.lua: Eratosthenes' sieve, implemented with streams thanks to lazy syntax extension.
- samples/tutorial-match.lua: the tutorial from the manual.
- samples/tutorial-typecheck.lua: the tutorial from the manual.
- lib:
The standard library extension provided with Metalua. Part of it (std.lua) directly extends modules of Lua's standard libraries; others are dedicated to compile-time meta-programming. - lib/std.lua: standard library extensions. Written in Lua 5.1 compatible code.
- lib/strict.lua: makes global variables declarations mandatory; taken from Lua sources. Catches lots of silly bugs.
- lib/hygienic.lua*: hygienic macros (through alpha renaming; should be rewritten with a generic code walker).
- lib/walk.lua: Generic code walker generator. Still very alpha.
- lib/ext-syntax:
Some syntax extensions are provided with Metalua. They are loaded in two parts: a compile-time one which alters the parser and generates the code, listed here; and a runtime part, possibly empty, which provides any helper code required by the extension. - lib/ext-syntax/classes.lua: implementation-agnostic syntax for class-based OO programming.
- lib/ext-syntax/clist.lua: lists by comprehension, list splicing, list sub-sampling. Deserves much more comments.
- lib/ext-syntax/continue.lua: "continue" statement for for/while/repeat loops, implemented with a code walker.
- lib/ext-syntax/exceptions.lua: syntactical support for exceptions, based on pcall().
- lib/ext-syntax/lazy.lua: support for lazy evaluation. Still very preliminary.
- lib/ext-syntax/letin.lua: "let some_variable = some_value in some_value" syntax extension, to bind a variable locally to an expression.
- lib/ext-syntax/match.lua: ML-style structural pattern matching.
- lib/ext-syntax/onwith.lua: simple extension for functors, typically over tables.
- lib/ext-syntax/ternary.lua: C's ternary "question mark" choice operator.
- lib/ext-lib:
Syntax extensions: the runtime parts. Many of these are empty. - lib/ext-lib/classes.lua
- lib/ext-lib/clist.lua
- lib/ext-lib/continue.lua
- lib/ext-lib/exceptions.lua
- lib/ext-lib/lazy.lua
- lib/ext-lib/letin.lua
- lib/ext-lib/match.lua
- lib/ext-lib/onwith.lua
- lib/ext-lib/ternary.lua
- lib/ext-lib/types.lua
- compiler:
These are the sources of the compiler. Some parts of it are carefully designed and implemented, but the commodity parts, which are little more than scaffolding, are intended to be rewritten from scratch at some point. These are marked with an asterix*. - compiler/gg.lua: grammar (parsers) generator.
- compiler/mlp_expr.lua: parser for (Meta)Lua expressions.
- compiler/mlp_ext.lua: Metalua syntax extensions w.r.t. plain Lua.
- compiler/mlp_lexer.lua: (Meta)Lua lexer.
- compiler/mlp_meta.lua: meta-operators +{...} and -{...}.
- compiler/mlp_stat.lua: (Meta)Lua statements parser.
- compiler/mlp_table.lua: (Meta)Lua table constructors parser.
- compiler/mlp_misc.lua: miscelaneous parser bits, which don't fit anywhere else.
- compiler/mlc.lua*: Metalua compiler wrapper.
- compiler/frontend.lua: command line option handling, main program.
- compiler/compile.lua*: AST to bytecode compiler.
- compiler/lopcodes.lua*: bytecode structure declarations.
- compiler/lcode.lua*: bytecode generation helpers.
- compiler/ldump.lua*: dumping bytecode structures into binary strings.