Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Andy Walker Newsgroups: comp.compilers Subject: Re: specifying semantics, was Formatting of Language LRMs Date: Sun, 29 Jun 2014 11:19:43 +0100 Organization: Not very much Lines: 41 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-06-029@comp.compilers> References: <14-06-010@comp.compilers> <14-06-023@comp.compilers> <14-06-025@comp.compilers> <14-06-027@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1404055642 6269 2001:470:1f07:1126:0:676f:7373:6970 (29 Jun 2014 15:27:22 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sun, 29 Jun 2014 15:27:22 +0000 (UTC) Keywords: syntax, semantics Posted-Date: 29 Jun 2014 11:27:22 EDT 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:1284 On 28/06/14 20:25, Ivan Godard wrote: > On 6/25/2014 9:54 PM, George Neuner wrote: >> Moreover, there are 3 broad categories of semantic description: >> operational, denotational and axiomatic. [...] > Where would you place VWG on the operational/denotational/axiomatic > spectrum? The point about vWGs is that they are *grammars*, so are not themselves concerned with semantics. What they do is push back the boundaries between syntax and semantics, so that many concepts that are usually thought of as semantic in nature are syntax in a vWG. The canonical example is the relationship between declaration and use of a given identifier; in context-free grammars, this has to be described outside the grammar, whereas in a vWG the declaration can add the identifier and its type to a "nest" and each use can check that the use is consistent with the current nest. As vWGs are Turing-complete, there is no difficulty *in principle* in writing an entire compiler [or interpreter] as a vWG; your source code would either fail to compile or would [entirely from the grammar] generate machine code [or be interpreted]. In such a case, there need be no "semantics" at all; your program either has a syntax error or else generates some output and reaches a halt state. The only *major* use of vWGs thus far stopped far short of that; the Algol 68 report broadly treats all compile-time decisions and actions as syntax, and all run-time decisions and actions as semantics. Actual Algol compilers stop far short even of that; but that is a QoI matter. According to the Report, the code ( int i; j := 2 ) is wrong simply because it does not correspond to any expansion of the notion "program"; but I can't imagine any compiler would fail to produce a helpful error message such as "j not declared" rather than merely "syntax error". -- Andy Walker, Nottingham.