|Can syntax be enough? No need of semantics. firstname.lastname@example.org (Srinu) (2009-09-13)|
|Re: Can syntax be enough? No need of semantics. email@example.com (Quinn Tyler Jackson) (2009-09-18)|
|Re: Can syntax be enough? No need of semantics. firstname.lastname@example.org (Andy Walker) (2009-09-18)|
|Re: Can syntax be enough? No need of semantics. email@example.com (2009-09-18)|
|Re: Can syntax be enough? No need of semantics. firstname.lastname@example.org (Andy Walker) (2009-09-19)|
|Re: Can syntax be enough? No need of semantics. email@example.com (Tony Finch) (2009-09-21)|
|Re: Can syntax be enough? No need of semantics. firstname.lastname@example.org (2009-09-23)|
|Re: Can syntax be enough? No need of semantics. email@example.com (gopi) (2009-09-24)|
|[2 later articles]|
|From:||Quinn Tyler Jackson <firstname.lastname@example.org>|
|Date:||Fri, 18 Sep 2009 09:36:35 -0700|
|Posted-Date:||18 Sep 2009 15:28:49 EDT|
> 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.
> Compiler shall not need semantics checking. Idea is to remove
> semantics checking phase from a compiler.
> Can this be possible?
Our moderator noted:
> [I've never seen a grammar that could handle in a reasonable checks
> that variables are declared before use, and that types of subexpressions
> match. -John]
To which I reply:
It is entirely possible to put semantic checks into a grammar and
thereby avoid ad hockery.* I have a grammar that does what John is
talking about for a lab-language created for the purpose of
demonstrating variable declaration and type checking. I have also
demonstrated the grammar structures necessary for a more subtle case:
member variables in C++ classes can be declared *after* they are
referenced in inline member function blocks. In fact, doing as much as
possible in a grammar (rather than in attached semantic code) has been
one of my Holy Grails for some time. (The correct grammar-only
processing of C++, for instance.) Another example is the Perl grammar.
Language theorists will immediately recognize that this cannot be done
by Type 2 constructs. The kinds of semantic checking being discussed
*can* be handled by a Type 0 system, however, and the state of the art
in generally available parsing engines is a very small subset of Type
1, if even that.
Many of these things are discussed in my book (Adapting to Babel) ad
nauseam with the charts, examples, experimental results, et cetera.
Quinn Tyler Jackson
* Where here "ad hockery" is defined as "doing in code rather than in
Return to the
Search the comp.compilers archives again.