Re: parsing ISO C++(1998/2003)

"Aaron Gray" <ang.usenet@gmail.com>
27 Apr 2007 11:31:49 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: parsing ISO C++(1998/2003) parthaspanda2005@yahoo.com (2007-04-19)
Re: parsing ISO C++(1998/2003) ang.usenet@gmail.com (Aaron Gray) (2007-04-23)
Re: parsing ISO C++(1998/2003) haberg@math.su.se (2007-04-23)
Re: parsing ISO C++(1998/2003) idbaxter@semdesigns.com (Ira Baxter) (2007-04-26)
Re: parsing ISO C++(1998/2003) torbenm@app-7.diku.dk (2007-04-26)
Re: parsing ISO C++(1998/2003) ang.usenet@gmail.com (Aaron Gray) (2007-04-27)
Re: parsing ISO C++(1998/2003) ang.usenet@gmail.com (Aaron Gray) (2007-04-27)
Re: parsing ISO C++(1998/2003) idbaxter@semdesigns.com (Ira Baxter) (2007-04-28)
Re: parsing ISO C++(1998/2003) idbaxter@semdesigns.com (Ira Baxter) (2007-04-28)
Re: parsing ISO C++(1998/2003) idbaxter@semdesigns.com (Ira Baxter) (2007-04-28)
| List of all articles for this month |

From: "Aaron Gray" <ang.usenet@gmail.com>
Newsgroups: comp.compilers
Date: 27 Apr 2007 11:31:49 -0400
Organization: Compilers Central
References: 07-04-052 07-04-059 07-04-069 07-04-085 07-04-110
Keywords: C++, parse
Posted-Date: 27 Apr 2007 11:31:49 EDT

"Torben "Ęgidius" Mogensen" <torbenm@app-7.diku.dk> wrote in message
> "Aaron Gray" <ang.usenet@gmail.com> writes:
>
>
>> What would be a good tool is something that takes an ambiguous
>> grammar an generates a GLR grammar. I am not sure whether this
>> problem is decidable or not though.
>
> GLR parsers are able to parse ambiguous grammars, so this is trivially
> true.


The programmer has to program the points at which the GLR actually branches.


> What you need, however, is a way to choose which one of the
> many parse trees that the GLR parser gives you that you want, and I
> can see no way of getting this automatically -- unless you can
> formally specify disambiguation rules (such as operator precedence
> rules). Operator precendence rules are insufficient to make the C++
> grammar unambiguous, though.


It's a case of transforming (or pruning) the AST. This may be done by
transformation rules but probably better done by bespoke code for
efficiency reasons.


Aaron



Post a followup to this message

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