Terence Parr
Terence Parr

Reputation: 5962

Java 1.5 grammar doesn't build

Anybody get the java 1.5 grammar working in Rascal?

https://raw.github.com/cwi-swat/rascal/master/src/org/rascalmpl/library/lang/java/syntax/Java15.rsc

I get:

$ java -jar rascal-0.5.1.jar Java15.rsc Disambiguate.rsc
Parse error in cwd:///Java15.rsc from <997,24> to <997,25>

997 is some freaky stuff:

bool expectedAmb({(Expr)`(<RefType t>) <Expr e>`, appl(_,[(Expr)`(<ExprName n>)`,_*])}) = true; // (A) + 1
bool expectedAmb({appl(_,[_*,(Expr)`(<RefType t>) <Expr e>`]), appl(_,[appl(_,[_*,(Expr)`(<ExprName n>)`]),_*])}) = true; // 1 + (A) + 1
default bool expectedAmb(set[Tree] t) = false;

Char 24 is the ` I think.

Terence

Upvotes: 2

Views: 205

Answers (1)

Davy Landman
Davy Landman

Reputation: 15438

Yes, this grammar uses the newer syntax for Concrete Syntax. The current stable rascal release does not support this. (That is also why the public release does not contain this grammar yet)

To use this grammar you will have to download the unstable release (replace stable in update url with unstable) or build Rascal locally to get a rascal shell. In these cases, you won't need separate files.

To answer your question, yes the grammar works, and we've been able to parse quite some Java files with it.

Upvotes: 3

Related Questions