Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1711

Re: precedences vs. hierarchy

Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From George Neuner <gneuner2@comcast.net>
Newsgroups comp.compilers
Subject Re: precedences vs. hierarchy
Date Mon, 06 Jun 2016 12:35:55 -0400
Organization A noiseless patient Spider
Lines 33
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <16-06-005@comp.compilers> (permalink)
References <16-06-001@comp.compilers>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 8bit
Injection-Info miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="23873"; mail-complaints-to="abuse@iecc.com"
Keywords parse
Posted-Date 07 Jun 2016 10:54:27 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:1711

Show key headers only | View raw


On Mon, 6 Jun 2016 09:08:56 +0200, Andreas Schramm
<bassobajo@gmail.com> wrote:

>for specifying the syntax of operator expressions
>with multiple levels of precedences,
>there are essentially two approaches:
>(i) by precedence and associativity declarations, and
>(ii) by a hierarchy of non-terminals.
>Both approaches have been known and in use for decades.
>
>My question is:
>Are there trends in the public opinion
>in favor of one of them over the other?
>Or are they equally respected approaches?

In general, precedence is shorter and easier to define.  However when
there are many levels, associativity can be hard to get right, and
incorrect associativity chaining can be difficult to debug.

Non-terminal operator heirarchies are more work to define, but they
usually are easier to fix when associativity is wrong.

Your tools will dictate which approach you can use:  few (if any) LL
tools support operator precedence, while all (?) LR tools do support
it.   If your tool supports precedence, you still can choose to use an
explicit heirarchy instead if that works better for you.

What matters most is getting your grammar right ... don't worry too
much about what other people think of it.

Hope this helps,
George

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

precedences vs. hierarchy Andreas Schramm <bassobajo@gmail.com> - 2016-06-06 09:08 +0200
  Re: precedences vs. hierarchy "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-06-06 17:08 +0200
    Re: precedences vs. hierarchy Kaz Kylheku <545-066-4921@kylheku.com> - 2016-06-07 15:35 +0000
      Re: precedences vs. hierarchy "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2016-06-07 22:53 +0200
      Re: precedences vs. hierarchy anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-06-08 09:48 +0000
  Re: precedences vs. hierarchy George Neuner <gneuner2@comcast.net> - 2016-06-06 12:35 -0400
  Re: precedences vs. hierarchy federation2005@netzero.com - 2016-06-06 14:01 -0700
    Example: The Full Syntax Of Prolog (Re: precedences vs. hierarchy) rockbrentwood@gmail.com - 2016-08-24 15:45 -0700

csiph-web