0

is it possible to write an antlr4 program which executes the code on a dynamic list. As an example I have a list in Scala:

val list = List[String]("Data1","Data2","Data3","0,19 €")

I want a create a program which executes defined functions on this list. For example:

parseToDouble(3)
concat(1,3,parseToDouble(3))

The reason is simple. We have many csv files which contains any kind of data. Each one of this should have a dedicated execution command sequence to create a new file which fits our needs. Unluckily it is impossible to change the csv files.

If that is possible and I created the program. I want load this program and give the list of string as an parameter to the program like a knowledge base. How can I do this? Is their any tut to help me understand this way?

Thank you.

  • Yes, it's possible. ANTLR doesn't actually care what you use the parsed tree for, you can do anything you want with it - including evaluating it on the elements of a list. "How can I do this?" is quite an open-ended question though and you'll unlikely get a satisfactory answer. Tutorial requests are explicitly off topic on Stack Overflow. The Definitive ANTLR 4 Reference is probably your best bet when it comes to learning how to use ANTLR 4 to parse your language, but it won't help you with evaluating it beyond telling you how to work with ANTLR's visitors in general. – sepp2k Aug 16 '18 at 19:09
  • okay. The Definitive ANTLR 4 Reference is on the way. That is good to know. I think this can help me: https://stackoverflow.com/questions/30976962/nested-boolean-expression-parser-using-antlr ? – André Schmidt Aug 16 '18 at 19:41

0 Answers0