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

后端 未结 12 1162
时光说笑
时光说笑 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:45

    I've used SableCC in my compiler course, though not by choice.

    I remember finding it very bulky and heavyweight, with more emphasis on cleanliness than convenience (no operator precedence or anything; you have to state that in the grammar).

    I'd probably want to use something else if I had the choice. My experiences with yacc (for C) and happy (for Haskell) have both been pleasant.

提交回复
热议问题