Metalua

What

Metalua is a language and a compiler which provide:

  • Full compatibility with Lua 5.1 sources and bytecode: clean, elegant semantics and syntax, amazing expressive power, good performances, near-universal portability.
  • A complete macro system, similar in power to what's offfered by Lisp dialects or Template Haskell; manipulated programs can be seen as source code, as abstract syntax trees, or as an arbitrary mix thereof, whichever suits your task better.
  • A dynamically extensible parser, which lets you support your macros with a syntax that blends nicely with the rest of the language.
  • A set of language extensions, all implemented as regular metalua macros.

How

When compared with Lisps' approaches to metaprogramming, Metalua makes the following choices:

  • Don't bother developers with macros when they aren't writing one: the language's syntax and semantics should be best suited for those 95% of the time when we aren't writing macros.
  • Encourage developers to follow the conventions of the language: not only with "best practices rants" nobody listen to, but by offering an API that makes it easier to write things the Metalua Way. Readability by fellow developers is more important and more difficult to achieve than readability by compilers, and for this, having a common set of respected conventions helps a lot.
  • Yet provide all the power one's willing to handle. Neither Lua nor Metalua are into mandatory bondage and discipline, so if you know what you're doing, the language won't get in your way.
  • Make it obvious when something interesting happens: all meta-operations happen between +{...} and -{...}, and visually stick out of the regular code.

Where

Metalua can be downloaded here; its sources can be browsed online or retrieved from the git repository

.

Your can have a one minute look at it, or read the full manual.

You might also want to check out the Lua Reference Manual