Using ANTLR to generate lexer/parser as streams

坚强是说给别人听的谎言 提交于 2019-12-08 08:47:14

问题


Can I use the ANTLR Java API to generate the lexer/parser as streams and save them somewhere other than some files?

Also, is there a simple example of using the API to generate the required files from a given grammar?

thanks


回答1:


I am not 100% sure if I understand your question correctly, but you might want to have a look at https://stackoverflow.com/a/38052798/5068458. This is an in-memory compiler for antlr grammars that generates lexer and parser for a given grammar in-memory. You do not have to do it manually. Code examples are provided there.

Best, Julian



来源:https://stackoverflow.com/questions/37598786/using-antlr-to-generate-lexer-parser-as-streams

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!