Re: Grammar with low-precedence postfix operator?

Stefan Monnier <monnier@iro.umontreal.ca>
Sun, 08 Feb 2015 12:34:27 -0500

          From comp.compilers

Related articles
Grammar with low-precedence postfix operator? rljacobson@gmail.com (Robert Jacobson) (2015-02-05)
Re: Grammar with low-precedence postfix operator? kaz@kylheku.com (Kaz Kylheku) (2015-02-05)
Re: Grammar with low-precedence postfix operator? anton@mips.complang.tuwien.ac.at (2015-02-07)
Re: Grammar with low-precedence postfix operator? rljacobson@gmail.com (Robert Jacobson) (2015-02-07)
Re: Grammar with low-precedence postfix operator? monnier@iro.umontreal.ca (Stefan Monnier) (2015-02-08)
Re: Grammar with low-precedence postfix operator? kaz@kylheku.com (Kaz Kylheku) (2015-02-09)
Re: Grammar with low-precedence postfix operator? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2015-02-09)
Re: Grammar with low-precedence postfix operator? jgk@panix.com (2015-02-10)
Re: Grammar with low-precedence postfix operator? kaz@kylheku.com (Kaz Kylheku) (2015-02-11)
Re: Grammar with low-precedence postfix operator? rljacobson@gmail.com (Robert Jacobson) (2015-02-21)
| List of all articles for this month |
From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: comp.compilers
Date: Sun, 08 Feb 2015 12:34:27 -0500
Organization: A noiseless patient Spider
References: 15-02-006
Keywords: parse
Posted-Date: 08 Feb 2015 19:06:22 EST

> term
> : INT
> | '(' expr ')' //parentheses
> | <assoc=right> term '^' term //exponentiation
> | term term //implicit multiplication
> ;


> expr
> : term
> | ('+' | '-') expr //unary plus/minus
> | expr ('/' | '*') expr //division and explicit multiplication
> | expr ('+' | '-') expr //addition/subtraction
> | expr '++' //increment
> ;


This last production rule is wrong: "expr ++" should produce a "term", not
an "expr".




                Stefan


Post a followup to this message

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