Re: Dangling else

Brian Inglis <>
11 Mar 2006 23:33:24 -0500

          From comp.compilers

Related articles
[7 earlier articles]
Re: Dangling else (=?ISO-8859-1?Q?Jan_Vorbr=FCggen?=) (2006-03-05)
Re: Dangling else (2006-03-05)
Re: Dangling else (Dave Thompson) (2006-03-05)
Re: Dangling else (Dmitry A. Kazakov) (2006-03-06)
Re: Dangling else (Russ Cox) (2006-03-06)
Re: Dangling else (Marco van de Voort) (2006-03-11)
Re: Dangling else (Brian Inglis) (2006-03-11)
Re: dynamic precedence, was Dangling else (Chris F Clark) (2006-03-12)
Re: dynamic precedence, was Dangling else (Alex Colvin) (2006-03-14)
Re: Dangling else (2006-03-14)
Re: dynamic precedence, was Dangling else (2006-03-14)
Re: Dangling else (Karsten Nyblad) (2006-03-15)
Re: Dangling else (Hans-Peter Diettrich) (2006-03-15)
[3 later articles]
| List of all articles for this month |

From: Brian Inglis <>
Newsgroups: comp.compilers
Date: 11 Mar 2006 23:33:24 -0500
Organization: Systematic Software
References: 06-02-154 06-02-168
Keywords: syntax, parse
Posted-Date: 11 Mar 2006 23:33:24 EST

fOn 24 Feb 2006 13:20:47 -0500 in comp.compilers, "Russ Cox"
<> wrote:

>I find the "make the programmer do it" approach to precedence
>completely unsatisfying. I'd rather just have "expression" and then
>give a list of operator precedences somewhere than have to compile the
>precedences into the grammar by hand with "postfix_expression",
>"cast_expression", "unary_expression", etc. Creating the equivalent
>no-precedence-table version of a grammar is a completely mechanical
>and tedious transformation that a well-written computer program is
>much less likely to make a mistake doing than a human.

>Should I really have to know, when writing the relational_expression
>rules, that shift_expression is the next level down in the precedence
>hierarchy? What if some new operator comes along later that I want
>to put between them? Then I have to go find all the rules that implicitly
>"know" that shift comes after relational.
>If there's a precedence table, I just add the new "expression" rules
>and then insert a new line in the precedence table. How is this a bad

I can't think of a language that allows specified or modified
precedence, other than Algol 68, which required a priority on operator
definitions; but 2 level vanWijngaarden grammars do not seem to be in
use now.

Thanks. Take care, Brian Inglis Calgary, Alberta, Canada

Post a followup to this message

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