Is it possible to compile syntax parser from grammar defintion (in String variable) in runtime using ANTLR .jar ?
I want to synthesize grammar description programmatically in beanshell environment, and then call ANTLR to make parser object, without using any files.
Yes it is possible since the parser generator itself is written in Java.
What you need is:
org.antlr.Tool
. The only thing I'm not sure about is whether it is possible to build the parser from a String - maybe you'll have to save it into a temporary file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.