Re: precedences vs. hierarchy

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Wed, 08 Jun 2016 09:48:49 GMT

          From comp.compilers

Related articles
precedences vs. hierarchy bassobajo@gmail.com (Andreas Schramm) (2016-06-06)
Re: precedences vs. hierarchy mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2016-06-06)
Re: precedences vs. hierarchy gneuner2@comcast.net (George Neuner) (2016-06-06)
Re: precedences vs. hierarchy federation2005@netzero.com (2016-06-06)
precedences vs. hierarchy slkpg4@gmail.com (SLK Mail) (2016-06-07)
Re: precedences vs. hierarchy 545-066-4921@kylheku.com (Kaz Kylheku) (2016-06-07)
Re: precedences vs. hierarchy mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2016-06-07)
Re: precedences vs. hierarchy anton@mips.complang.tuwien.ac.at (2016-06-08)
| List of all articles for this month |
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Wed, 08 Jun 2016 09:48:49 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 16-06-001 16-06-004 16-06-008
Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="72777"; mail-complaints-to="abuse@iecc.com"
Keywords: parse
Posted-Date: 10 Jun 2016 22:23:21 EDT

Kaz Kylheku <545-066-4921@kylheku.com> writes:
>You need the concept of associativity to tell whether
>A + B + C is (A + B) + C or A + (B + C).


But if + is really associative (e.g., not FP addition), these two are
equivalent.


>In table shift-reduce parsers (Yacc, and such), associativity rules
>resolve conflicts.


Of course, you can also write the grammar in an unambiguous way, then
you don't need associativity rules to resolve the ambiguity; a
disadvantage of precedence and associativity declarations is that they
can hide more ambiguities than you intended.


- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/



Post a followup to this message

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