[antlr-interest] Lemon parser. Any comments?

Paul Johnson gt54-antlr at cyconix.com
Mon Dec 19 07:41:52 PST 2005


[I'm assuming that this was meant to go to the list, so I've copied your 
entire message below...]

Ruslan Zasukhin wrote:
> On 12/19/05 12:52 PM, "Paul Johnson" <gt54-antlr at cyconix.com> wrote:
> 
> 
>>>The biggest difference is that, as the documents say, "In yacc and
>>>bison, the parser calls the tokenizer. In Lemon, the tokenizer calls
>>>the parser."
>>
>>There seem to be various Bison hacks around to do it both ways. I think
>>this may become a supported feature at some point.
> 
> 
> For me the most interesting features of lemon comparing to YACC are:
> 
> * no $n values, instead easy named parameters
> 
> * no global variables, so can be used in threads
> 
> * can run several parsers in the same time.
> 
> * faster of YACC (claimed)
> 
> * also they have auto-destructors for terminal symbols.
> 
> So at least 5 features over YACC.



---------------

> * no $n values, instead easy named parameters

I've never really seen this as a problem; it seems natural enough in 
normal use.

> * no global variables, so can be used in threads

'%pure-parser' will give you a re-entrant parser; all the globals are 
turned into locals. I haven't tried this.

> * can run several parsers in the same time.

I already do this, and I know of others doing the same. You can do this 
even without the re-entrant option by changing the prefix on the global 
names (-p option on the command line??)

> * faster of YACC (claimed)

No idea, I'm afraid. However, parsing is a small fraction of my total 
compilation time.

> * also they have auto-destructors for terminal symbols.

Not sure that I understand this. However, I've had no memory leak problems.

Note also that Bison has had multi-token lookahead for several years now 
(it uses GLR).

Paul



More information about the antlr-interest mailing list