Re: Seeking bison/yacc grammar for Java language

glen herrmannsfeldt <gah@ugcs.caltech.edu>
2 May 2004 21:50:22 -0400

          From comp.compilers

Related articles
Seeking bison/yacc grammar for Java language hq@national.org.nz (Evil B) (2004-04-29)
Re: Seeking bison/yacc grammar for Java language snicol@apk.net (Scott Nicol) (2004-05-02)
Re: Seeking bison/yacc grammar for Java language gah@ugcs.caltech.edu (glen herrmannsfeldt) (2004-05-02)
Re: Seeking bison/yacc grammar for Java language xxxx@xxxx.xx (Jose Antonio) (2004-05-08)
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 2 May 2004 21:50:22 -0400
Organization: Comcast Online
References: 04-04-099
Keywords: parse, Java
Posted-Date: 02 May 2004 21:50:22 EDT

Evil B wrote:


> Does anyone have a working yacc/bison grammar for the full java language?


> I've been tinkering away at one for a few days, but have hit a roadblock:


> When adding 'Type . class' to 'PrimaryNoNewArray' [1], I end up with 10
> shift/reduce and 2 reduce/reduce conflicts, and most java sources fail
> to parse.


It might be that there are some true conflicts in the grammar, resolved
only be the language definition, similar to the way that if-then-else
is resolved in C. (Each else closes the nearest preceding if.)


It is legal to have a class name, method name, and instance name,
and maybe package name all the same, though not recommended for style
reasons. Consider that, and the possible conflicts that might arise.


(I once wrote a JNI static method to read the x86 time stamp counter,
class and method both called rdtsc.)


-- glen


Post a followup to this message

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