What is the difference between ANTLR and parboiled for parsing in Java?
Parboiled looks like a really cool tool. It might be easier for beginners as it is just pure programming using a "parser combinator" idiom. I think that this would become very verbose and harder to read, though the Java grammar doesn't look too bad that I see. I cannot comment on its AST construction but ANTLR 4 generates parse trees not a ASTs. It claims to have good error messages/recovery but that is suspect because it is based upon parser expression grammars, which can only detect errors once the entire input is been seen (worst case). It also cannot identify ambiguities in your grammar (not conflicts, ambiguities). Neither tool announces parsing conflicts. ANTLR 4 handles direct left recursion for things like arithmetic expressions but in general neither tool can handle left recursion. ANTLR requires that you use a library for its parser interpreter like parboiled but you must learn to use the tool if you want to have it generate parsers. Currently, ANTLR 4 can generate parsers in Java, C#, JavaScript, Python 2, Python 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With