Re: Dangling else

Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
11 Mar 2006 23:33:24 -0500

          From comp.compilers

Related articles
[7 earlier articles]
Re: Dangling else jvorbrueggen-not@mediasec.de (=?ISO-8859-1?Q?Jan_Vorbr=FCggen?=) (2006-03-05)
Re: Dangling else henry@spsystems.net (2006-03-05)
Re: Dangling else david.thompson1@worldnet.att.net (Dave Thompson) (2006-03-05)
Re: Dangling else mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2006-03-06)
Re: Dangling else rsc@swtch.com (Russ Cox) (2006-03-06)
Re: Dangling else marcov@stack.nl (Marco van de Voort) (2006-03-11)
Re: Dangling else Brian.Inglis@SystematicSW.ab.ca (Brian Inglis) (2006-03-11)
Re: dynamic precedence, was Dangling else cfc@shell01.TheWorld.com (Chris F Clark) (2006-03-12)
Re: dynamic precedence, was Dangling else alexc@TheWorld.com (Alex Colvin) (2006-03-14)
Re: Dangling else henry@spsystems.net (2006-03-14)
Re: dynamic precedence, was Dangling else torbenm@app-4.diku.dk (2006-03-14)
Re: Dangling else 148f3wg02@sneakemail.com (Karsten Nyblad) (2006-03-15)
Re: Dangling else DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-03-15)
[3 later articles]
| List of all articles for this month |

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

fOn 24 Feb 2006 13:20:47 -0500 in comp.compilers, "Russ Cox"
<rsc@swtch.com> 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
>thing?


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.