Related articles |
---|
power of SLR thant@acm.org (Thant Tessman) (2001-09-16) |
Re: power of SLR jjan@cs.rug.nl (J.H.Jongejan) (2001-09-20) |
Re: power of SLR thant@acm.org (Thant Tessman) (2001-09-20) |
Re: power of SLR blp@stanford.edu (Ben Pfaff) (2001-09-25) |
From: | "J.H.Jongejan" <jjan@cs.rug.nl> |
Newsgroups: | comp.compilers |
Date: | 20 Sep 2001 00:27:09 -0400 |
Organization: | Groningen University (NL) |
References: | 01-09-059 |
Keywords: | parse |
Posted-Date: | 20 Sep 2001 00:27:09 EDT |
Thant Tessman wrote:
>
> I've implemented the SLR parser generator described in Appel's "Modern
> Compiler Implementation in ML," but I've implemented it in C++. I
> chose SLR because it was the most clearly described technique.
>
> The parser generator seems to work on the example grammar in the book,
> but reports ambiguities in grammars like the canonical:
>
> E -> E - T
> E -> T
> T -> T / F
> T -> F
> F -> id
> F -> ( E )
This grammar is SLR(1). It contains two states with a shift/reduce
conflict. However they are solvable using follow information:
E -> T. E -> E-T.
T -> T./F T -> T./F
In both cases follow(E) does not contain the '/'.
--
Regards,
Jan Jongejan
Dept. Comp.Sci.,
Univ. of Groningen,
Netherlands.
email: jjan@cs.rug.nl
Return to the
comp.compilers page.
Search the
comp.compilers archives again.