Is ANTLR 4 faster than ANTLR 3?
Asked Answered
T

1

8

What should I expect from ANTLR 4?

Is it faster ANTLR 3? I mean the parsing speed.
Note code generation speed would be interesting too.

For design reasons?

Towle answered 16/12, 2012 at 10:20 Comment(0)
K
10

First the easy part - the ANTLR 4 tool performs only minimal analysis of the grammar, and in particular does not need to statically compute the DFA tables like ANTLR 3 did. As such, it's much, much faster than ANTLR 3 for generating parsers.

The initial 4.0 release of ANTLR 4 varies from slightly faster than ANTLR 3 to much slower than it, depending on the grammar and input. However, ANTLR 4 is able to handle many grammars and inputs that ANTLR 3 simply cannot handle at all. In addition, an optimized version of the ANTLR 4 runtime which substantially outperforms ANTLR 3 is already in development.

Debugging aids and how-to documentation is coming which helps users find and correct (or avoid) performance problems related to grammar design. I believe some of this is available in the ANTLR 4 book as well.

Kimbrakimbrell answered 16/12, 2012 at 15:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.