> wouldn't you think that the right level of abstraction is
> the abstract syntax tree, with some tree manipulation library, and a generic
> mechanism to plug stuff into the parser during compilation?
The Lua parser does not build abstract syntax trees at all.
I should know, metalua would have been much faster to write if it did (although I understand the interest of not building it since you can avoid it). My point is that if you want to add syntax control features, the Lua Way of adding generic mechanisms instead of ad-hoc closed features would be to add explicit AST + control over it. I definitely realize it's a non-trivial change.
-- Fabien.