Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #3457
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Deep expression chain performance |
| Date | 2023-04-27 06:17 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <23-04-016@comp.compilers> (permalink) |
| References | <23-04-012@comp.compilers> <23-04-015@comp.compilers> |
Kaz Kylheku <864-117-4973@kylheku.com> writes: >ISO C specifies its grammar in an obtusely verbose way, similar to the >above. The reason is that it makes the grammar unambiguous, meaning >that it does not require any annotation or external remarks about >ambiguities having to be resolved by a certain associativity or >precedence. They were not that keen on eliminating ambiguity. The classical ambiguous grammar rule is there: |selection-statement: | if ( expression ) statement | if ( expression ) statement else statement | switch ( expression ) statement They resolve that ambiguity in prose: |An else is associated with the lexically nearest preceding if that is |allowed by the syntax. C is not alone in this approach. As for why they chose to deal with expressions through BNF, my guess is that it allowed them to split the expression syntax into different sections, each with their own piece of the grammar, rather than having a section on the syntax that presents an ambuguous BNF and resolves the ambiguity in prose (and by necessity has to cover the whole expression syntax), and then having sections on the semantics of the various expression sub-syntaxes. - anton -- M. Anton Ertl anton@mips.complang.tuwien.ac.at http://www.complang.tuwien.ac.at/anton/
Back to comp.compilers | Previous | Next — Previous in thread | Find similar
Deep expression chain performance Andy <borucki.andrzej@gmail.com> - 2023-04-25 06:51 -0700
Re: Deep expression chain performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-04-26 16:33 +0000
Re: Deep expression chain performance gah4 <gah4@u.washington.edu> - 2023-04-26 13:06 -0700
Re: Deep expression chain performance Kaz Kylheku <864-117-4973@kylheku.com> - 2023-04-27 00:28 +0000
Re: Deep expression chain performance anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-04-27 06:17 +0000
csiph-web