Re: specifying semantics, was Formatting of Language LRMs

Andy Walker <news@cuboid.co.uk>
Sun, 29 Jun 2014 11:19:43 +0100

          From comp.compilers

Related articles
Formatting of Language LRMs seimarao@gmail.com (Seima Rao) (2014-06-17)
Re: specifying semantics, was Formatting of Language LRMs seimarao@gmail.com (2014-06-24)
Re: specifying semantics, was Formatting of Language LRMs lpsantil@gmail.com (lpsantil@gmail.com) (2014-06-24)
Re: specifying semantics, was Formatting of Language LRMs gneuner2@comcast.net (George Neuner) (2014-06-26)
Re: specifying semantics, was Formatting of Language LRMs news@cuboid.co.uk (Andy Walker) (2014-06-28)
Re: specifying semantics, was Formatting of Language LRMs ivan@ootbcomp.com (Ivan Godard) (2014-06-28)
Re: specifying semantics, was Formatting of Language LRMs gneuner2@comcast.net (George Neuner) (2014-06-28)
Re: specifying semantics, was Formatting of Language LRMs news@cuboid.co.uk (Andy Walker) (2014-06-29)
Re: specifying semantics, was Formatting of Language LRMs gneuner2@comcast.net (George Neuner) (2014-06-29)
Re: specifying semantics, was Formatting of Language LRMs ivan@ootbcomp.com (Ivan Godard) (2014-06-29)
Re: specifying semantics, was Formatting of Language LRMs genew@telus.net (Gene Wirchenko) (2014-06-30)
Re: specifying semantics, was Formatting of Language LRMs ivan@ootbcomp.com (Ivan Godard) (2014-06-30)
Re: specifying semantics, was Formatting of Language LRMs anton@mips.complang.tuwien.ac.at (2014-07-02)
Re: specifying semantics, was Formatting of Language LRMs monnier@iro.umontreal.ca (Stefan Monnier) (2014-07-03)
[3 later articles]
| List of all articles for this month |
From: Andy Walker <news@cuboid.co.uk>
Newsgroups: comp.compilers
Date: Sun, 29 Jun 2014 11:19:43 +0100
Organization: Not very much
References: 14-06-010 14-06-023 14-06-025 14-06-027
Keywords: syntax, semantics
Posted-Date: 29 Jun 2014 11:27:22 EDT

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.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.