Metalua is a metaprogramming extension to Lua 5.1, i.e. a compiler which allows to extend the language's syntax and semantics from within programs
The subtitle for the homepage is: "Lisp extensibility, Lua syntax"
The two "samples" are rather impressive:
Typechecking introduces optional runtime type checking into Lua. It features syntax extension (addition of a typing operator), existing syntax modification (functions get their parameters and returned values checked), and non-local code modification (return statements in functions are chased down to get additional typechecking code).
Pattern matching demonstrates how to add pattern matching, a distinctive feature of languages from the ML family, into Lua. These complex testing control statements are compiled into a (possibly long) list of if statements and local variables bindings. They are supported by a syntax extension which shows how to save a lot of work by reusing Lua's expression syntax with a very different semantics.
Note for ML programmers: I feared that pattern matching without type inference would be hard to use; it's actually quite pleasant, and I hadn't many issues with the lack of static typing.
Recent comments
22 weeks 6 days ago
22 weeks 6 days ago
22 weeks 6 days ago
45 weeks 19 hours ago
49 weeks 2 days ago
50 weeks 6 days ago
50 weeks 6 days ago
1 year 1 week ago
1 year 6 weeks ago
1 year 6 weeks ago