0

I would like to ask how to make input recognition for ANTLRv3 (especially v3.4) with Java Eclipse. From Antlr example here ANTLR: Is there a simple example?, the input has been initialized in the code. ANTLRStringStream in = new ANTLRStringStream("12*(5-6)");

What I wanted is the system could recognize/read user input and then do the calculation.

I have read this too: Extending simple ANTLR grammer to support input variables but this doesn't work for me.

Community
  • 1
  • 1
  • What exactly is giving you problems? The problem description "doesn't work for me" tells me nothing meaningful in order to help you. – Bart Kiers May 02 '14 at 18:41
  • Hmm sorry, I mean for the `public Double evaluate(String string, Map input) etc`. How to create the main test java to run that? – javabeginner May 02 '14 at 20:29
  • You create a class with a `main` method and for each line the user enters, you'll create a new parser and parse this input. You can feed the `Map` from the previous parse into the next parse. I suggest you try something before posting back: it's hard to help you without seeing what you've tried to solve it. – Bart Kiers May 03 '14 at 09:48

0 Answers0