lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Nov 09, 2004 at 09:59:26PM -0800, Quinn Tyler Jackson wrote:

> The idea was that I could implement some kind of #macro functionality in a
> "super-Lua", parse that super-Lua in the $-grammar, then, in the final
> stage, using the _visit event, traverse the tree, expand the macros, and
> then feed that expanded version into the CLua object for interpretation.
> ...
> << 4 example functions >>

This was intriguing enough to send me on a brief visit to the Grammar
Forge.  If I understood what I was seeing correctly, the objects in the
parse tree generated from Lua input are not Lua objects, but only tokens
from the Lua input plus the recognized non-terminals from the $-grammar.  

This is perfect for macro transformations within $-grammar space, but it
doesn't allow Lua to manipulate active Lua objects.  It's very powerful,
but it's not introspective.  It wouldn't allow a Lua subprogram to fail
on an unexpected semantic error condition, a new exception handler be
crafted on the fly and added to it, and the new subprogram restarted.

The great thing about languages in which every object is a first-class
citizen is that in principle they *can* talk about themselves, despite
the cautions imposed by Godel and Russell.  Lua is certainly capable of
it ... "all" it needs is a normalized syntax tree with its nodes giving
access to the run-time objects, plus back links into the tree which maybe
could be held in some sort of attribute space like others have mentioned.

Then Lua could do the rest through introspection and re-synthesis.

Rich Artym.
-- 
Existing media are so disconnected from reality that our policy debates
spin around a fantasy world in which the future looks far too much like
the past.   http://www.zyvex.com/nanotech/MITtecRvwSmlWrld/article.html