我尝试像这样运行 JSON2XML_ST:
bab@maz:~/tpantlr2-code/code/listeners$ antlr4 JSON.g4
bab@maz:~/tpantlr2-code/code/listeners$ javac JSON2XML_ST.java
bab@maz:~/tpantlr2-code/code/listeners$ java JSON2XML_ST t.json
但艾得到:
(json (object { (pair "description" : (value "An imaginary server config file")) ,
(pair "logs" : (value (object { (pair "level" : (value "verbose")) , (pair "dir" :
(value "/var/log")) }))) , (pair "host" : (value "antlr.org")) , (pair "admin" : (value
(array [ (value "parrt") , (value "tombu") ]))) , (pair "aliases" : (value (array [
]))) }))
Exception in thread "main" java.lang.IllegalArgumentException: No such group file: XML.stg
at org.stringtemplate.v4.STGroupFile.<init>(STGroupFile.java:69)
at org.stringtemplate.v4.STGroupFile.<init>(STGroupFile.java:48)
at JSON2XML_ST$XMLEmitter.<init>(JSON2XML_ST.java:45)
at JSON2XML_ST.main(JSON2XML_ST.java:140)
为什么 ??有谁能够帮我?谢谢你。