Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Stefan Monnier Newsgroups: comp.compilers Subject: Re: Semantics, opt in Semantics Date: Sun, 18 Jan 2015 10:03:47 -0500 Organization: A noiseless patient Spider Lines: 29 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <15-01-029@comp.compilers> References: <15-01-013@comp.compilers> <15-01-023@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain X-Trace: miucha.iecc.com 1421608120 18626 2001:470:1f07:1126:0:676f:7373:6970 (18 Jan 2015 19:08:40 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sun, 18 Jan 2015 19:08:40 +0000 (UTC) Keywords: semantics Posted-Date: 18 Jan 2015 14:08:40 EST 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:1486 > As to the first question the complexity of semanticsx has resulted in a > large variety of notations: the van Wijngaarden two level grammar, the > Vienna Definition Language/Vienna Development Method, Denotational > semantics, attribute grammars,etc. The most commonly used formalism nowadays in the programming languages community is operational semantics (either "small step" or "big step"). While denotational semantics can be thought of as "compiling the language to set-theory" (or to some kind of pure lambda calculus), operational semantics looks more like an interpreter. Its popularity is probably largely due to the fact that it's defined in 2 steps: first define the "machine" you use to represent the intermediate states, and then define the transition rules. So you can define the machine according to your needs. As for "optional", I'm not sure what you (the OP) meant by that. Already in the syntax case, it's not clear whether you meant "optional syntax" to mean "syntax which the implementation can choose to support or not" or "syntax which the user can decide to use or not". In the BNF usually you get the second rather than the first, but the equivalent for semantics ("semantics which the user can choose to use or not") is generally implicit (which is a common reason why compilers can't perform particular optimizations or need sophisticated analyses before they can). Stefan