Re: Java 2.0 Grammar Problems

Kees van Reeuwijk <>
15 Feb 2001 00:44:01 -0500

          From comp.compilers

Related articles
Java 2.0 Grammar Problems (Michael Schoettner) (2001-02-12)
Re: Java 2.0 Grammar Problems (Kees van Reeuwijk) (2001-02-15)
Re: Java 2.0 Grammar Problems (Thomas Maslen) (2001-02-17)
Re: Java 2.0 Grammar Problems (Kees van Reeuwijk) (2001-02-23)
Re: Java 2.0 Grammar Problems (Peter Bertelsen) (2001-02-25)
Re: Java 2.0 Grammar Problems (2001-03-01)
| List of all articles for this month |

From: Kees van Reeuwijk <>
Newsgroups: comp.compilers
Date: 15 Feb 2001 00:44:01 -0500
Organization: Delft University of Technology
References: 01-02-040
Keywords: Java, parse
Posted-Date: 15 Feb 2001 00:44:01 EST

On 12 Feb 2001 01:10:22 -0500, "Michael Schoettner"
<> wrote:

>we are currently investigating the Java 2.0 grammer of the Java Language
>Specification (second edition) for an own Java compiler. We are faced with
>problems in some productions (an example is shown below). Does anybody have
>experience with the Java 2.0 grammer? Alternative grammers in EBNF for Java
>2.0 would also be an option. A short e-mail would be great. Many thanks in
>advance for your efforts.

I prefer to reply to this newsgroup, since other people may be

The grammar in the appendix of JLS2 indeed has problems. The ambiguity
you showed in your message is an example, and there are other issues. If
someone is interested I can post the bug reports I sent to Sun about

I never received official confirmation, but I unofficially Sun agrees
that the appendix is, uhm, less than perfect.

My Spar/Java compiler, Timber, contains a yacc grammar for Java plus a
number language extensions. Apart from the extensions, the compiler very
closely follows the Java language, so it might be just what you are
looking for; see <>.

Alternatively, you may want to use the grammar from the 1st edition of
the JLS, which is very good, and take the grammar for the language
extensions of JLS2 from the body of the text.

Post a followup to this message

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