Re: Parsing fully context-free grammars
- From: "Paul Mann" <paul@xxxxxxxxxxxx>
- Date: 2 Oct 2005 02:49:56 -0400
> Also, APG always disambiguates to a single parse tree. However,
> looking at the "dangling else", I've found that is easy to get either
> translation from the single parse tree. That is,
>
> if(expr) then {if(expr) then {stmt} else {stmt}}
> or
> if(expr) then {if(expr) then {stmt}} else {stmt}.
>
> Lowell Thomas
This is one of the problems with GLR parsers. When you have a grammar
that is ambiguous, such as this case of the dangling 'else' problem,
then you get a parser that is ambiguous also.
This problem can be resolved at the grammar level and avoid the
ambiguity at the parsing level. This creates a shift-reduce conflict
which is resolved by chosing the shift action by most parser generators
of the non-GLR type.
The problem is the ambiguity in the grammar, which cannot be solved by
later symbol-table lookup's and discarding subtrees with semantic errors.
It's just plain ambiguous and shows one of the pitfalls of GLR systems.
Paul Mann
http://parsetec.com
.
- Follow-Ups:
- Re: Parsing fully context-free grammars
- From: Evangelos Drikos
- Re: Parsing fully context-free grammars
- Prev by Date: Re: Table-driven Parser
- Next by Date: Re: Parsing fully context-free grammars
- Previous by thread: Re: Table-driven Parser
- Next by thread: Re: Parsing fully context-free grammars
- Index(es):
Relevant Pages
|