[antlr-interest] Coctail vs ANTLR

Ric Klaren klaren at cs.utwente.nl
Mon Oct 1 14:08:49 PDT 2001


On Mon, Oct 01, 2001 at 07:43:11PM +0300, Ruslan Zasukhin wrote:
> It looks for me that better keep grammar and parser as LL(1),
> and avoid using of it as LL(2).

Mwoch LL(2) isn't bad.. predicates are bad every ( ) => ( ) introduces
backtracking. And that is really expensive. With k=2 you can catch a lot.
If you do the factoring of your grammar religiously then you can circumvent
also a lot of backtracking at the expense of readability of your grammar
(in general).

> Am I right that we always can use left factoring to modify some rules from
> LL(2) to LL(1) grammar ?

Guess so.

> May be only thing to really improve in ATLR, as you have mention -- scanner.
> FLEX is better.

I don't have any hard figures but I suspect it is better. I even recall
some posts in the past that said that flex was faster.

> Ric, I wonder that you say that scanner is bad because is used the same
> codegenerator as in parser. I see in code generator that is used
>         
>         if(state == Lex)
>         if(state == parser)
>         if(state == treewalker)
> 
> So having this we still can not get good scanner ?

We can have better codegen, but probably at the expense of some flexibility.
Also the codegenerator becomes more and more draconian to look at. I'd
prefer some rewriting...

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
 Why don't we just invite them to dinner and massacre them all when they're
  drunk? You heard the man. There's seven hundred thousand of them. Ah? ..
           So it'd have to be something simple with pasta, then.
                 From: Interesting Times by Terry Pratchet


 

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



More information about the antlr-interest mailing list