Re: [QUERY] A "ignorant newbie" question about compiler-writing.

mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz)
4 Jan 1997 20:50:03 -0500

          From comp.compilers

Related articles
[QUERY] A "ignorant newbie" question about compiler-writing. synaptik@why.net (1997-01-02)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. dennis@netcom.com (1997-01-03)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. jlilley@empathy.com (1997-01-03)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. robison@kai.com (Arch Robison) (1997-01-03)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. mw@ipx2.rz.uni-mannheim.de (1997-01-04)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (1997-01-29)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (1997-01-29)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. mw@ipx2.rz.uni-mannheim.de (1997-01-30)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. darius@phidani.be (Darius Blasband) (1997-01-30)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (J. Kanze) (1997-01-30)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. iainf@bristol.st.com (1997-02-07)
[8 later articles]
| List of all articles for this month |

From: mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz)
Newsgroups: comp.compilers
Date: 4 Jan 1997 20:50:03 -0500
Organization: ---
References: 97-01-013 97-01-029
Keywords: symbols, practice, Java

John Lilley (jlilley@empathy.com) wrote:


> The symbol table in some languages like Java, C or C++ is necessary
> even for a syntactic parse, because typedefs determine what is an
> identifier vs a type, and there are places in the grammar where it
> must be known what is a type and what is not for the parse to
> proceed correctly.


That's not true for Java. The language specification (available online
as http://java.sun.com/doc/language_specification.html) contains a
chapter with a complete LALR(1) grammar, which one can feed to yacc
without complaints, after expanding the usage of an "opt"-Suffix to
several alternatives with and without the respective optional element.


The grammar which is used throughout the book for presentation does
indeed contain some non-LALR(1) constructs, but the above chapter
explains the grammar transformations which get rid of those problems,
and gives the final result. This may also be worth reading as a nice
intro to the kind of stuff one should expect if one wants to use yacc
or similar tools for existing languages. (When designing a new
language, it's not very difficult to get it "clean" in the first
place, though I'd even strive for LL(1) rather than LALR(1) in that
case.)


-- Marc Wachowitz <mw@ipx2.rz.uni-mannheim.de>
--


Post a followup to this message

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