Elr

Elr is a parser and lexical analyser generator in the tradition of yacc (external link) and
lex (external link). Unlike most other tools of this nature, it generates both from a single combined input grammar, and supports automatic lexical disambiguation based on the parser state. Currently the only supported target languages are C and C++.

It originally started out in life as a research prototype, and languished for a number of years in academic obscurity. However, in the interests of being able to use it myself, I've resurrected it and started converting it into a real production tool. I intend to rev this fairly quickly for a few weeks until it's satisfactorily stabilised, and then it will probably only be updated as bugs/features are found/requested.

Note: despite the name, it currently only handles LALR(1) BNF grammars. The original intention was to support full LR(1) and EBNF, but they have not yet been implemented.

Elr is now being maintained on sourceforge at http://sourceforge.net/projects/elr (external link).

Latest release:
    arrowElr 0.5.3(23 Jun 2007)

    Changelog:
    Fixed string stack bug (stack left in an incorrect position following reduction and string shift)
    Fixed fencepost error in lalr generation (broke horribly if the number of terminals was a multiple of 32)
    Added expected tokens information to parser error output.
    Added #line directives to generated output
    Started adding CppUnit (external link) based unit tests

Older releases:
    arrowElr 0.5.2(14 Jun 2007)

    Changelog: Fix ambiguity in the input grammar (all directives now end in either a semicolon or a block) Preliminary C++ support.

    arrowElr 0.5.1(23 May 2007)

    Changelog: Fix -v command line flag Fix line/column counting Change parser return type to the type of the start symbol. Add shift/reduce conflict warnings Add "expected conflicts" flag (ala Cup) Add case-insensitive grammar flag Add disable automatic disambiguation flag Add parser name grammar flag Add command-line usage help Add automatic typing of default reductions along with some basic type sanity checking. Add ability to generate simple header files Remove useless debugging information Elr 0.5(13 May 2007)

    First release version post-prototype. It generally works as one would expect, but is lacking in documention and diagnostics. It has not been extensively tested and probably contains bugs. It also has no ability to disable the lexical disambiguation, which makes it unsuitable for many existing reserved-word based languages. However it is darn handy for supporting the sorts of domain-specific or configuration languages that crop up all the time. Requires a recent version of G++ (external link) to build (4.0 or later should work)

PS. If anyone finds this tool useful (or potentially so), please drop me a line.

About me

Nathan is a full-time software engineer and part-time maintainer of several pieces of open-source software that noone has even heard of (most notably lxdream and elr). His interests include programming language design, distributed systems, emulation, Japanese, and go.