Re: A few questions about parsing

"Ira Baxter" <idbaxter@semdesigns.com>
Wed, 2 Sep 2009 14:32:53 -0500

          From comp.compilers

Related articles
A few questions about parsing chakaram@auth.gr (Chariton Karamitas) (2009-08-31)
Re: A few questions about parsing haberg_20080406@math.su.se (Hans Aberg) (2009-08-31)
Re: A few questions about parsing idbaxter@semdesigns.com (Ira Baxter) (2009-09-02)
| List of all articles for this month |
From: "Ira Baxter" <idbaxter@semdesigns.com>
Newsgroups: comp.compilers
Date: Wed, 2 Sep 2009 14:32:53 -0500
Organization: Compilers Central
References: 09-08-059 09-09-002
Keywords: parse, C++
Posted-Date: 05 Sep 2009 00:06:05 EDT

"Hans Aberg" <haberg_20080406@math.su.se> wrote in message
> Chariton Karamitas wrote:
>> 1. I've been able to parse the C BNF syntax given in K&R 2nd edition
>
>> 2. What parser can parse this grammar? An LR? LALR? LL?
>
> You find Yaccable (LALR(1)) grammars for C and C++ here:
> http://www.quut.com/c/ANSI-C-grammar-y.html
> http://www.parashift.com/c++-faq-lite/compiler-dependencies.html#faq-38.11


Unless you're a glutton for punishment, you really don't want to go
down "roll your own (or even patch up Willink's) C++ parser route".
As an undergrad, the OP will be very well served to stick with trying
to parse C, learning about disambiguating syntax forms using type
information, and building symbol tables for that with the agreement
that C++ is just worse. Reading Willink's thesis is probably a good
way to get a faint sense of how much worse.


To go anywhere with C++, you not only need to parse, but you have to get
the symbol table and name/type resolution right, and that's about 400 pages
of reference manual worse.


If he wants to study a working version of a C++ front end, the EDG one is
available for academics, and so is Elsa.


-- IDB



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.