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

Oliver Zeigermann oliver at zeigermann.de
Sun May 25 03:18:41 PDT 2003


--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at j...> 
wrote:
> 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.

It seems you forgot about left recursion in grammars which can not 
be handled with ANTLR or any other top down approach. Also, what 
about ambigous grammars? ANTLR hardly generates more than a single 
parse tree ;)

Of course, as I also admitted, ANTLR can handle all context free 
*languages* (not *grammars*).

I think the question is not the class of languages you can parse - 
as with ANTLR I am pretty sure (even though I can not proove it) it 
is phrase structure languages - but the way you can express it. 
Using no tool at all, but a turing machine, you can just as well 
parse phrase-structure languages. So what is the use of a tool like 
ANTLR? It is the elegant way to describe the language using a 
grammar. So, the question is what kind of grammar can you use to 
describe the language. If this question was not important why using 
LL(k>1) grammars? You can always left factor, so LL(k) can never 
describe a language you can not describe by LL(k-1). The answer is 
convenience. A LL(k) grammar might be much more readble than a LL(k-
1) one.

Oliver


 

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




More information about the antlr-interest mailing list