« Return to Thread: compiler in applications

Re: compiler in applications

by Artur Rataj :: Rate this Message:

Reply to Author | View in Thread

Hello.

Just instantiate the parser object, and then call the production that represents
the stream you parse, like:

parser = new JavaParser(fileName);
Unit unit = parser.CompilationUnit();

The productions are just methods in the generated file.

Best regards,
Artur


 I am a newby to javacc and have started to use javacc to create some
simple grammars. I would like to use javacc for a larger project, but need
to know how to use the created compiler in an own java application. So far,
all examples I have seen describe how to start the generated compiler as a
main() method, reading input from System.in. However, I would like to use
the generated compiler from my own program by passing a String object. Is
there any documentation how to do this or is it so trivial that I should
have figured out myself how to do it? ;-)

Thanks and best regards for your help and time,

 Philipp.


 « Return to Thread: compiler in applications