How can I parse code to build a compiler in Java?

后端 未结 12 1164
时光说笑
时光说笑 2021-02-09 06:08

I need to write a compiler. It\'s homework at the univ. The teacher told us that we can use any API we want to do the parsing of the code, as long as it is a good one. That way

12条回答
  •  日久生厌
    2021-02-09 06:50

    I'd recommend using either a metacompiler like ANTLR, or a simple parser combinator library. Functional Java has a parser combinator API. There's also JParsec. Both of these are based on the Parsec library for Haskell.

提交回复
热议问题