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

mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz)
30 Jan 1997 22:23:37 -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)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. mff@research.att.com (Mary Fernandez) (1997-02-11)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. dennis@netcom.com (1997-02-16)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (1997-02-16)
[5 later articles]
| List of all articles for this month |

From: mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz)
Newsgroups: comp.compilers
Date: 30 Jan 1997 22:23:37 -0500
Organization: ---
References: 97-01-013 97-01-029 97-01-034 97-01-235
Keywords: parse, design

J. Kanze (kanze@gabi-soft.fr) wrote:
> mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz) writes:
> > [scanner doesn't need to tell the parser about type names vs. identifiers]


> I can't believe that no one answered this. The fact that the you can
> feed the grammar to yacc without complaints doesn't contradict what
> John said.


Of course not; that part of my statement was merely meant to indicate
how easy it is to derive a yacc parser for Java from the text of the
reference manual. Nevertheless, nothing like the typedef-hack for C is
needed in a Java scanner - the parser works with just one kind of
token for whatever looks like an identifier (minus reserved words).


Of course, the semantic analysis will need to make some decisions
_for_itself_ about whether some name refers e.g. to a package or a
field reference into a variable, and in one case it must _check_ that
what's accepted as an expression in the grammar is in fact merely a
name, but the parser can do its work completely without the semantic
analysis phase. The conceptual division between scanner, parser and
semantic analysis is quite clean.


> I'm not familiar enough with Java to assert that this is true, but
> it looks enough like C/C++ to make me think it is probably so.


Java's syntax isn't even as hard to parse as C's syntax, and C++ is
much worse. If you don't believe me, please read the grammar and the
related discussion of the language specification, for which I've given
the URL in the previous posting. It's chapter 19, named "LALR(1)
Grammar", and really not very difficult to understand if one has a
little practical background knowledge about these things (no big deep
theory required).


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