Re: Can syntax be enough? No need of semantics.

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Fri, 18 Sep 2009 18:17:28 GMT

          From comp.compilers

Related articles
Can syntax be enough? No need of semantics. sinu.nayak2001@gmail.com (Srinu) (2009-09-13)
Re: Can syntax be enough? No need of semantics. quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2009-09-18)
Re: Can syntax be enough? No need of semantics. news@cuboid.co.uk (Andy Walker) (2009-09-18)
Re: Can syntax be enough? No need of semantics. anton@mips.complang.tuwien.ac.at (2009-09-18)
Re: Can syntax be enough? No need of semantics. news@cuboid.co.uk (Andy Walker) (2009-09-19)
Re: Can syntax be enough? No need of semantics. dot@dotat.at (Tony Finch) (2009-09-21)
Re: Can syntax be enough? No need of semantics. torbenm@pc-003.diku.dk (2009-09-23)
Re: Can syntax be enough? No need of semantics. gopi.onthemove@gmail.com (gopi) (2009-09-24)
Re: Can syntax be enough? No need of semantics. gopi.onthemove@gmail.com (gopi) (2009-09-24)
Re: Can syntax be enough? No need of semantics. sinu.nayak2001@gmail.com (Srinu) (2009-09-29)
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Fri, 18 Sep 2009 18:17:28 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 09-09-062
Keywords: theory, parse
Posted-Date: 18 Sep 2009 15:29:39 EDT

Srinu <sinu.nayak2001@gmail.com> writes:
>Can we have a language/grammar, which doesn't need any semantics
>checking for it to be able to correctly interpreted by its compiler? I
>mean, if some statement of this language/grammar satisfies the syntax
>of the grammar, then it is a perfect statement and a compiler can
>perform right things according to what the statement specifies.


That's just a question of what you see as syntax and what as "static
semantics". The current mainstream is to consider things described by
a context-free grammar as syntax and anything beyond that that has to
be statically checked as static semantics. But you can just as well
say that anything checked at compile time is syntax.


>Compiler shall not need semantics checking.


For the regular scanner and the context-free parser it is quite
popular to use a generator, whereas the rest is typically written in a
general-purpose programming language. Even if the scanner and/or
parser are written by hand, they are still often conceptually using a
specific formalism (e.g., context-free grammar as specification) and
implementation methodology (e.g., recursive-descent) that sets it
apart from the rest. That also seems to be useful for organizing the
compiler (e.g., syntax-directed compilation).


You can use some formalism for something more powerful than
context-free grammars to define all of the statically checkable parts
of a programming language, e.g., a Van Wijngaarden grammar. However,
that particular formalism has not caught on for specifying programming
languages and even less for compilers.


- 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.