lua-users home
lua-l archive

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


On Mon, 2005-01-17 at 10:56, Luiz Henrique de Figueiredo wrote:
> > seems like most if not all calls for core changes in
> > this area just want the parser to add yet more sugar.
> 
> Along this line, I've been working on a simple add-on core module that
> introduces token filters, which give you the opportunity to see the raw
> tokens coming from the lexer before they go to the parser and you can
> alter them. Perfect for adding sugar. 

Well not perfect :) The problem is that to add the sugar,
you have to parse the input stream according to your 
extended grammar, apply rewriting rules to the subtrees
corresponding to reductions, and then rewrite the resultant
modified trees out again as token streams.

In other words, you have to duplicate the whole parser
and modify it, and you also can't add new token types
since you're reading a stream of tokens produced
by the standard lexer.


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net