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.

2
  • 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. Commented Aug 16, 2018 at 19:09
  • okay. The Definitive ANTLR 4 Reference is on the way. That is good to know. I think this can help me: stackoverflow.com/questions/30976962/… ? Commented Aug 16, 2018 at 19:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.