Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: gah4 Newsgroups: comp.compilers Subject: Re: Why are ambiguous grammars usually a bad idea? Why are languages usually defined and implemented with ambiguous grammars? Date: Wed, 29 Dec 2021 18:41:17 -0800 (PST) Organization: Compilers Central Lines: 32 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <21-12-022@comp.compilers> References: <21-12-003@comp.compilers> <21-12-017@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="30766"; mail-complaints-to="abuse@iecc.com" Keywords: parse, history, comment Posted-Date: 29 Dec 2021 22:28:31 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <21-12-017@comp.compilers> Xref: csiph.com comp.compilers:2776 On Wednesday, December 29, 2021 at 2:28:34 PM UTC-8, Kaz Kylheku wrote: (snip) > I also believe there is one more element at play: mathematics. People > study mathematics in school, and those who go on to do programming tend > to be ones who were more exposed to it or paid more attention. This reminds me of learning associativity of exponentiation (**) in Fortran IV (I believe it isn't in the Fortran 66 standard) before I learned it in algebra class. I suspect that there are others I learned from programming before learning them in math class > People who are programmers actually had a first contact with formal > syntax in mathematics. > The conflation between syntax and semantics may ultimately come from > that place. Mathematicians design their notations deliberately, in such > ways that when they manipulate symbols, while observing certain rules, > they are actually preserving semantics. The notation directly enables > semantically meaningful manipulation, as a tool of thought. I suspect that people learn some things in the first programming language that they learn, and then expect it to be the same in others. When it isn't, people get surprised or confused. When I started with unix, I learned csh programming, and mostly avoided sh (and successors). One reason for that is, as well as I knew at the time, differences in the syntax and semantics of them. [Fortran has always had ** exponentiation, starting with the original version in 1956. It always bound tighter than +-*/ but wasn't associative, A**B**C not allowed, -John]