[prog] Yacc - double errors (EOF detection)

Daniel. cristofd at hevanet.com
Tue Feb 10 23:48:38 EST 2004


>  >I still feel no wiser about why I would want to use yacc though, so I may
>>not do any more after this is done.
>
>Yacc is convenient if your grammar can be easily described with BNF
>(Baukus Nau Format(sp?)).

"Backus-Naur Form".

>  But if your grammar is complex, like C++, then
>yacc simply can't handle it.  This is why the GCC developers re-wrote the
>C++ parser from scratch without yacc.  For simple things, though, it beats
>writing the entire parser by hand.

On the other hand, some toy languages are too simple to be worth 
using yacc for. For the language she's implementing, it's not obvious 
to me whether it'd be easier to use yacc or to just use lex and write 
the rest in C. (For the even simpler language Yaroslav and I were 
mentioning earlier, the appropriate parser is getchar() combined with 
a switch statement and maybe a rudimentary stack.) My impression is 
that yacc is well suited for a wide midrange of complexity--from a 
little above the four-function-calculator level, up past the C 
language level. Is this correct?
-Daniel.
-- 
        ()  ASCII ribbon campaign      ()    Hopeless ribbon campaign
        /\    against HTML mail        /\  against gratuitous bloodshed


More information about the Programming mailing list