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 parser combinators, and also of ANTLR3, and am wondering: which would provide better performance and ease of writing code? So far:
ANTLR pros
- Well-known
- Fast
- External DSL
- ANTLRWorks (great IDE for parser grammer debugging/testing)
ANTLR cons
- Java-based (Scala interop may be challenging, any experience?)
- Requires a large dependency at runtime
Parser combinator pros
- Part of Scala
- One less build step
- No need for a runtime dependency; e.g. already included in Scala's runtime library
Parser combinator cons
- Internal DSL (may mean slower execution?)
- No ANTLRWorks (provides nice parser testing and visualization features)
Any thoughts?
EDIT: This expression parser parses algebraic/calculus expressions. It will be used in the app Magnificalc for Android when it is finalized.