Scala parser combinators vs ANTLR/Java generated parser?

后端 未结 5 1099
自闭症患者
自闭症患者 2020-12-28 15:29

I am writing an expression parser for an app written mostly in Scala. I have built AST objects in Scala, and now need to write the parser. I have heard of Scala\'s built-in

5条回答
  •  無奈伤痛
    2020-12-28 16:16

    I have created external DSLs both with ANTLRv4 and Scalas parser combinators and I clearly prefer the parser combinators, because you get excellent editor support when designing the language and it's very easy to transform your parsing results to any AST case class data structure. Developing ANTLR grammars takes much more time, because, even with the ANTLRWorks editor support, developing grammars is very error-prone. The whole ANTLR workflow feels quite bloated to me compared to the parser combinators' one.

提交回复
热议问题