In ANTLR 3, how do I generate a lexer (and parser) at runtime instead of ahead of time?

前端 未结 3 2066
小鲜肉
小鲜肉 2021-02-06 13:56

I want to generate an antlr lexer at runtime -- that is, generate the grammar and from the grammar generate the lexer class, and its supporting bits at runtime. I am happy to fe

3条回答
  •  长情又很酷
    2021-02-06 14:25

    Have you tried calling org.antlr.Tool.main(String[]) with an appropriate String[] argument?

    If that's too cumbersome, you could reverse engineer the Tool class (source code) to figure out how it works, and how to do the specific tasks you need to do.

提交回复
热议问题