|OILexer: How Important is Readability? email@example.com (Alexander Morou) (2015-06-24)|
|From:||Alexander Morou <firstname.lastname@example.org>|
|Date:||Wed, 24 Jun 2015 01:24:29 -0500|
|Posted-Date:||26 Jun 2015 15:02:00 EDT|
I've been posting about this project for quite some time, and I finally
reached the LL(1) stage in OILexer.
Using the ambiguity free json language, building a contextual parse tree
and a subsequent AST from the annotations in the grammar, it appears to
operate at a level of up to 2-6 times faster than ANTLR4 on spin-up, to
two thirds the speed of ANTLR4 once ANTLR4 has parsed a file once
(I think they call it 'spinning up'.) ANTLR4 was used as a reference
because it's the closest thing that I can think of to this project, with
the exception that ANTLR4's code is nigh unreadable and no longer
generates an AST as of version 4.
Mind you these metrics are 'without error handling' so if it's a properly
formed input string, it parses correctly, I haven't tested invalid input
because I haven't added error handling code.
That brings me to my question today: how important is readability in
a generated parser?
Here is a link to the current generated json parser, you'll note the
lack of error handling, but this is currently because my focus is
finishing LL predictions:
For future's sake, the outline of the valid syntax at the states within
the parser can be found here (to be used during error reporting):
The individual properties it returns can be clicked to go to their
The grammar file relevant to this can be found here:
Since I started this project I wanted to try to create code that was
as easy to read as possible (since I started this as a parsing
newbie). There are some performance concerns that I will address
once predictions are finished, but as of right now they're secondary
to readability. I don't want to optimize too early because I feel getting
it functional should be first.
-Allen Clark Copeland, Jr.
Return to the
Search the comp.compilers archives again.