#1251: Use Parsing Expression Grammar for Par Files -------------------------+-------------------------------------------------- Reporter: sbrandt | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Component: Other | Version: Keywords: | -------------------------+-------------------------------------------------- Piraha is a parsing framework/library based on Parsing Expression Grammars (PEGs). This allows you to define the grammar of a language using a simple regular-expression-type language, and Piraha will use this to decode an input file into a hierarchical data structure of the parsed data (a "parse tree"). See http://code.google.com/p/piraha-peg/, http://en.wikipedia.org/wiki/Parsing_expression_grammar.
I've hacked a version of Cactus to use Piraha for parameter parsing. Please take a look:
https://svn.cactuscode.org/flesh/branches/with_piraha
This version is able to run the ET testsuite.
This version can understand the variables $parfile, $ENV{name}, and $pi (which is 3.14...). Variables can be standalone, or be substituted from inside strings.
It can understand mathematical expressions including grouping, order of operation, and a few functions (sin, cos, tan, exp, sqrt). Other parameters from the parameter file are available for use in mathematical expressions.
Some debug printing is in place so you can get an idea of what's going on.