Re: specifying semantics, was Formatting of Language LRMs

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Wed, 02 Jul 2014 09:51:51 GMT

          From comp.compilers

Related articles
[6 earlier articles]
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)
Re: specifying semantics, was Formatting of Language LRMs genew@telus.net (Gene Wirchenko) (2014-07-03)
Re: specifying semantics, was Formatting of Language LRMs gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-07-04)
Re: specifying semantics, was Formatting of Language LRMs DrDiettrich1@aol.com (Hans-Peter Diettrich) (2014-07-04)
Re: Parsing Fortran, was specifying semantics gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-07-04)
Re: Parsing Fortran, was specifying semantics wclodius@earthlink.net (2014-07-04)
| List of all articles for this month |
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Wed, 02 Jul 2014 09:51:51 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 14-06-010 14-06-023 14-06-025 14-06-027 14-06-030 14-06-031
Keywords: semantics
Posted-Date: 02 Jul 2014 23:08:09 EDT

Ivan Godard <ivan@ootbcomp.com> writes:
>Well, conventionally the type system of a language is considered
>semantics, yet the whole Algol68 type system, including checking all
>expressions for type validity, is present in the VWG.


What is conventionally called "syntax" is an artifact of the compiler
technology (or maybe of specification technology, see below): Parsers
are based on context-free grammars, and anything that is not groked by
the parser is a syntax error, and what the parser accepts is
considered the syntax; and everything else is called the semantics.


And programming language specifications also follow that division:
most of them provide a context-free grammar, and provide everything
else in natural language.


However, "everything else" is a very wide category, and if you look
closer, you make further distinctions: There is static stuff and
run-time stuff; typically name lookups are done statically (you get an
error even if the code is not executed). One may consider the static
stuff "syntax", but I think a more usual term is "static semantics".
I think the vW stuff in Algol 68 is also static stuff.


There is also the run-time semantics.


There have been some ways to specify static stuff. vW grammars have
not caught on; attribute grammars are more successful, but for
compiler writers, not for language specifications; and even in
compilers attribute grammars are not very widely used. It's mostly
just code in the compiler implementation language.


For the dynamic stuff, there has been quite a bit of academic work
(operational semantics, denotational semantics (although I think they
make little difference between static and dynamic stuff), but few uses
in language specifications or compilers. I think Modula-3 used a
formal specification, but don't know about the type.


Generally, the problem of formal specifications is that, while they
may be precise, doing a complete formal specification is hard and they
are hard to understand (so it's easy to miss specification bugs).
Doing partial formal specifications for areas that are easier to
formally specify, and where the specifications are relatively easy to
understand has been much more successful (context-free grammars are to
most obvious example). And the rest is filled in with natural
language.


- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/


Post a followup to this message

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