Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.compilers Subject: Re: precedences vs. hierarchy Date: Wed, 08 Jun 2016 09:48:49 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 21 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <16-06-010@comp.compilers> References: <16-06-001@comp.compilers> <16-06-004@comp.compilers> <16-06-008@comp.compilers> 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 1674 X-Received-Body-CRC: 84645730 Xref: csiph.com comp.compilers:1716 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/