Re: Query regarding Semantic Analyzer
- From: "James Giles" <jamesgiles@xxxxxxxxxxxxxxxx>
- Date: Fri, 28 Apr 2006 17:20:05 GMT
Sorry if people see two versions of this. I made an
error. I cancelled the other message, but many may end
up seeing it anyway. Sorry.
pooja.bhateja@xxxxxxxxx wrote:
I have a query regarding Semantic analyzer. Are there any Formal
notations commonly used to define the semantics of a programming
language? (Similar to how BNF defines the syntax). [...]
There are. Most people aren't familiar with them.
[...] I am exploring
semantics and I found various formal notations:
Attribute grammars, Two level (W) Grammar, Denotational Semantics,
Operational semantics, Axiomatic semantics etc.
The first two you mention are notations that associate semantic
information with the language's syntax. Such notations could
be developed for any of the techniques of semantic specification
you mention.
*The other three (denotational, axiomatic, and operational) that
you mention are techniques for specifying semantics. They are
not necessarily notations (although for denotational and axiomatic
techniques the relevant researchers have pretty much settled on
common conventions). They have been proven (somewhere, I don't
have the reference handy) to be equivalent theoretically. So, to some
extent it's just a matter of which you find more natural.
There are occasionally remarks from various people that
one kind of semantics is better for a given purpose than
another. For example, I think denotational semantics is
more natural for language designers, operational semantics
is more natural for language users, and axiomatic semantics
is better for those trying to do formal proofs of the language's
correctness. Just an opinion. (However, most of the people
actually designing some languages are not really designers,
but users that are interested in pursuing some pet features.
For that reason, operational semantics might be preferable
since it's better for the ultimate users of the language anyway.)
It *may* boil down to what kind of semantics was used
by whoever wrote the most flexible automated tool you
can find - you may have no more choice than that unless
you plan to write your own tools.
I personally like denotational semantics best. I have an old
(well thumbed) book I recommend (if it's still available):
DENOTATIONAL SEMANTICS, A Methodology for
Language Development, by David Schmidt, Wm. C. Brown
publishers. It's old, but if you're interested in a good
introduction the clarity of presentation is more important
than being completely up to date (you can do that later when
you know more about what you're looking for). Maybe a
revised edition is out. It's mostly an introduction, not
a high-level text.
I have no favorites for axiomatic semantics. You'll find
several books (I have several) if you look around.
And operational semanitcs consists of defining the meaning of
language features in terms of what a well defined *simple*
machine does with each of them, in a step by step way. It's the
fact that the technique is so simple to grasp that makes it suitable for
languages users. They don't have to spend months (years?) learning
a new set of concepts. If there are books on it, I don't have any
(I suppose there must some be though).
Of course, the internet is also a resource. But it helps if you
know what you're looking for (and what you're looking at when
you've found something). There's no Royal Road...
--
* The asterisk marks the part that I had wrong before. A slip
of the cut and paste. But it made no sense as I wrote it before.
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
.
- References:
- Query regarding Semantic Analyzer
- From: pooja . bhateja
- Query regarding Semantic Analyzer
- Prev by Date: Re: Query regarding Semantic Analyzer
- Next by Date: contents of Fortran Forum April 2006
- Previous by thread: Re: Query regarding Semantic Analyzer
- Next by thread: contents of Fortran Forum April 2006
- Index(es):
Relevant Pages
|