[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: sugarcubes for me.my.self.and.I [Re: Lua OOP initiative]
- From: skaller <skaller@...>
- Date: 17 Jan 2005 14:05:41 +1100
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:email@example.com
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net