Lexer Parser

BRL-CAD needs to be able to express grammars for geometry formats in order to provide a flexible, fast, robust and comprehensive framework for conversion from one geometry format type to another. Ideally, we will use tools designed specifically to generate lexers and parsers to automate the "grunt work" of handling such formats. Candidates are listed below, with pros and cons. Decison criteria include license, portability, robustness and ease of integration with our existing build logic.


The 800 pound gorilla of open source lexers. BSD license. Modern versions require M4, which is why existing Windows versions stop at 2.54 - exploring NetBSD m4 as a possible supporting tool. GNU m4 is a possibility if NetBSD's version doesn't work for some reason.

Public domain. Seems like it can be built on Windows MSVC platforms. Searching around, it looks like re2c + lemon may be a relatively common approach for those looking to replace flex/bixon. A worked example: http://fasterparser.blogspot.com/2010/11/re2c-lexer-lemon-parser-calculator.html

C++, LGPL licensed. Author "doesn't like it to be used for military applications" although he apparently took the clause forbidding such use out of the license itself... Requres Python. Probably not viable for integration into BRL-CAD's build system, or at least not likely to be less trouble than flex itself.


800 pound gorilla for parsers. GNU GPL licensed, which pretty much makes it a non-starter for inclusion in BRL-CAD's tree.

License compatible, implements some of the Bison features of interest to us. Author has been quite helpful. Current front-runner.

License compatible, grammar definition style different from yacc.


Combination of GPL and LGPL - would have to dig to see if parts we need are usable or not. Probably not of primary interest unless other options start to look really grim.