|converting precedence to productions firstname.lastname@example.org (1996-10-03)|
|Re: converting precedence to productions email@example.com (Brian Bliss) (1996-10-06)|
|Re: converting precedence to productions firstname.lastname@example.org (Neil Faiman) (1996-10-08)|
|Re: converting precedence to productions email@example.com (1996-10-10)|
|From:||Brian Bliss <firstname.lastname@example.org>|
|Date:||6 Oct 1996 00:56:18 -0400|
Mark Saaltink wrote:
> I am trying to convert an operator precedence grammar to an
> unambiguous grammar without precedence rules. This is usually easy
> (e.g. expressions with normal precedence rules), but my grammar has a
> low-precedence postfix operator.
> The grammar looks something like this:
> S ::= n | S and S | S or S | S post | ( S )
> with left associativity, and precedence decreasing to the left.
S ::= S1 | S post
S1 ::= S2 | S1 post | S1 or S2
S2 ::= S3 | S2 post | S2 and S3
S3 ::= n | ( S )
you could also try drawing out the lalr parser tables and break the
appropriate shift arcs according to the precedence rules. there exists
an algorithm for converting any DPDA to a lr(0) grammar, albeit ugly.
the result, however, is a much smaller parser than the first approach.
Return to the
Search the comp.compilers archives again.