Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1526
| From | jgk@panix.com (Joe keane) |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Grammar with low-precedence postfix operator? |
| Date | 2015-02-10 21:03 +0000 |
| Organization | Public Access Networks Corp. |
| Message-ID | <15-02-024@comp.compilers> (permalink) |
| References | <15-02-006@comp.compilers> <15-02-014@comp.compilers> |
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote: >For your example involving ^ and ++, I think that one should use >parentheses explicitly in most cases, e.g. (a^b)++^c or a^(b++)^c. >You can leave away the parentheses if there is no ambiguity, as in >your 2++^3, but that's not straightforward to express in BNF. gcc does something like this You can say: if (x & y == 0) probable error, warn or reject if ((x & y) == 0) OK if (x & (y == 0)) OK, if that's what you want I don't know how it is implemented. if (x == 1 && y == 2) fine IMHO if ((x == 1) && (y == 2)) too many parens if (((x >= 1) && (x <= 2)) || ((y >= 1) && (y <= 2))) way too many parens IMHO, but shouldn't reject The reason you don't want to reject these is that, besides that it's style, they could come from macros. If you color parens in macros, you could also look out for macros: #define SUM(X, Y) (X)+(Y) probable error #define DOUBLE(X) (2*X) probable error
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Grammar with low-precedence postfix operator? Robert Jacobson <rljacobson@gmail.com> - 2015-02-05 13:27 -0500
Re: Grammar with low-precedence postfix operator? Kaz Kylheku <kaz@kylheku.com> - 2015-02-05 21:10 +0000
Re: Grammar with low-precedence postfix operator? Robert Jacobson <rljacobson@gmail.com> - 2015-02-07 10:30 -0800
Re: Grammar with low-precedence postfix operator? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-02-07 11:27 +0000
Re: Grammar with low-precedence postfix operator? jgk@panix.com (Joe keane) - 2015-02-10 21:03 +0000
Re: Grammar with low-precedence postfix operator? Kaz Kylheku <kaz@kylheku.com> - 2015-02-11 02:19 +0000
Re: Grammar with low-precedence postfix operator? Stefan Monnier <monnier@iro.umontreal.ca> - 2015-02-08 12:34 -0500
Re: Grammar with low-precedence postfix operator? Kaz Kylheku <kaz@kylheku.com> - 2015-02-09 01:24 +0000
Re: Grammar with low-precedence postfix operator? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2015-02-09 08:05 +0100
Re: Grammar with low-precedence postfix operator? Robert Jacobson <rljacobson@gmail.com> - 2015-02-21 12:55 -0800
csiph-web