Hi George, well, starting with speed, the key is to avoid stack
sensitive rules. Take a look at the Tech report on ALL(*) parsing in the
empirical data section:
http://www.antlr.org/papers/allstar-techreport.pdf
if you look at figure 13, all you will see a difference between the C
grammar (C11) with a faster one called C11SLL where we tweaked a single
rule. We used ANTLR’s DiagnosticErrorListener
object to identify the stack-sensitivity at parse time.
if you look at the DFA size per files parsed, you'll see a huge
difference between Java (top graph) and JavaSable (bottom graph).
JavaSable is a literal copy of the Java specification from the book
without concern for efficiency. (taken from SableCC's website). we
have a TestPerformance.java file that tells us which decisions take the
most model look ahead and so on. We plan on building a simple interface
possibly inside AW2 that will help out. We will also introduce automatic
left factoring to reduce lookahead requirements.
The short answer is there are lots of obvious left factorings that help
like:
decl : method_head method_body
| method_head ';' // interface
;
Here, matter what, we have to look all the way past the full method
head. we will automatically left factor this in a future version. For
the moment, you can merge the method_head.
Ter
> George S Cowan <mailto:
co...@acm.org>
> July 3, 2013 11:40 AM
> OK, Ter, give us a hint: What's the main difference between the two
> Java grammars that accounts for the radically different parse times.
>
> I hope it's not dozens of little tweaks that only you know how to
> make, or exhaustive testing of dozens of alternatives.
>
> George
>
>
> On Tuesday, July 2, 2013 12:31:48 PM UTC-4, the_antlr_guy wrote: --