I read in a tutorial that when you do something like that :
SimpleNode Program() #Program : {}
{
(Class_decl())* <EOF>
{ return jjtThis; }
}
it should create a Programm class which inherits from SimpleNode (once you compile with jjtree), but in my case it doesn’t create such as class. Do I have to create it myself or am I missing something ?
Thanks
Are you first using
jjtreeon your grammar (beforejavacc)? It works fine with me:file: Test.jjt
And then the commands:
which generates the following Java source files:
And both
ClassDeclandProgramextendSimpleNode:Compiling all source files and running the
Testclass:which will print:
(i.e.
Programis the root with twoClassDeclchildren)Tested with Java Compiler Compiler Version 5.0.