[antlr-interest] Re: antlr vs. sableCC comparison

Terence Parr parrt at jguru.com
Sat May 24 11:45:38 PDT 2003


On Saturday, May 24, 2003, at 04:19  AM, Oliver Zeigermann wrote:
>> Predicated LL(k) (ANTLR) parsing can handle any context-free
>> grammar, but LALR does not and modern versions of yacc support GLR
>> parsing to get past the LALR limitation.
>
> I think you mix something up here (or do I?). Surely neither YACC
> nor SableCC nor ANTLR can handle all context free grammars! What you
> wanted to say is any context free language, i.e. a language that can
> be described by a context free grammar, can also be described by an
> ANTLR grammar, right?

ANTLR's predicated LL(k) parsers can handle a class of languages that 
might be hard to nail down.  Because it has backtracking, it could in 
theory (backtracking every single decision) handle all context-free 
grammars.  Because it has semantic predicates it can handle some 
context-SENSITIVE languages.

>
> Anyway, please tell more about GLR. How does it work?
>
> Personally, I am fan of ANTLR and LL, but still, there are some good
> reasons to choose bottom up methods. Some purists like the idea of
> describing a language completely by the means of a most human
> readable and thus natural (hopefully context free) grammar. To use
> such grammars with LL or LR methods you will have to modify them. It
> turns out that LR methods need less modification of the grammar than
> LL, which is considered valuable by some pepole.

Correct.  I hate having to modify my grammar to satisfy a weak parsing 
method. :(  A tradeoff.

>> visitor
>>     :
>>     ( visit )+
>>     ;
>>
>> visit
>>     :
>>     (      .
>>     |      #( .  ( visit )+ )
>>     )
>>     ;
>
> I do not think that will work (maybe it does). How to decide between
> first and second alternative of rule visit?
>
> This will do, I think (visitor rule unchanged):
>
> visit
>     :
>     #( .  ( visit )* )
>     ;

Yeah, that looks right :)

Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list