Dear Brat, You're right..
But now I need to change my question because I found out that Parser.java generated from this action is different than Parser.java generated when I click 'Run..' in ANTLRWorks and give it an input text.. So my new question is: How, from the command line, do I run the grammar (giving it an input text file, let's say)? On Sat, May 22, 2010 at 1:54 PM, Bart Kiers <bki...@gmail.com> wrote: > On Sat, May 22, 2010 at 1:33 PM, Sameh W. Zaky <sameh...@gmail.com> wrote: > >> Greetings, >> >> I am still an ANTLR beginner.. >> >> I run a software where I generate the .g grammar file automatically. So I >> would love to know how to generate the lexer and parser at runtime given >> the >> .g file? >> > > When generating lexers/parser on the command line, you'd do something like > this: > > java -cp .:antlr-3.2.jar org.antlr.Tool /path/to/your/grammar.g > > (the Tool class has a static main method taking a command line parameter!) > So generating them in your own code would look like: > > String yourGrammarFile = "/path/to/your/grammar.g"; > org.antlr.Tool.main(new String[]{yourGrammarFile}); > > Kind regards, > > Bart. > ** > -- Sameh W. Zaky List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.