OILexer: How Important is Readability?

Alexander Morou <alexander.morou@gmail.com>
Wed, 24 Jun 2015 01:24:29 -0500

          From comp.compilers

Related articles
OILexer: How Important is Readability? alexander.morou@gmail.com (Alexander Morou) (2015-06-24)
| List of all articles for this month |
From: Alexander Morou <alexander.morou@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 24 Jun 2015 01:24:29 -0500
Organization: Compilers Central
Keywords: tools, question
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:
http://abstraction-project.com/text/Oilexer/Json/JsonParser.html


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):
http://abstraction-project.com/text/Oilexer/Json/JsonParser-1.html


The individual properties it returns can be clicked to go to their
definition.


The grammar file relevant to this can be found here:
http://abstraction-project.com/text/Oilexer/Json/json.oilexer.html


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.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.