I am looking to use Rascal's existing Java AST provided in the m3 library but I would like to extend this to add some features. We are working with a Java-like language (about 95% Java and 5% our specific features). Ideally, I'd like to be able to take the Java syntax and AST code (src/org/rascalmpl/library/lang/java/syntax/Java15.rsc
and src/org/rascalmpl/library/lang/java/m3/AST.rsc
, respectively) modify the syntax a bit and add some new AST nodes. Going through and exploring how this all works has shown this all doesn't work the same as the other language examples I've found.
For example, the constructors in Java15.rsc
don't match the constructors in AST.rsc
which is how all the other language examples appear to work. My current understanding of how this all works is when a user makes a call to createAstFromFile()
what actually happens is Rascal calls into some Java code which produces the AST.
I've tried a number of things, the most successful being started to rename the constructors in Java15.rsc
to match those in AST.rsc
but didn't make it too far before I realised this was going to be a daunting task and perhaps not the best way to approach this problem.
Is there anyway I can "easily" extract the syntax and AST portions here and modify them on my own?
Thanks.