Generate parser at runtime from rules database?

stuart.smith@totalise.co.uk
16 Sep 2006 16:00:15 -0400

          From comp.compilers

Related articles
Generate parser at runtime from rules database? stuart.smith@totalise.co.uk (2006-09-16)
| List of all articles for this month |

From: stuart.smith@totalise.co.uk
Newsgroups: comp.compilers
Date: 16 Sep 2006 16:00:15 -0400
Organization: Compilers Central
Keywords: parse, question
Posted-Date: 16 Sep 2006 16:00:15 EDT

We have a set of rules stored in a database that conform to a formal
grammar; I have used Boost/Spirit to write a parser to check that the
rules themselves conform to the expected grammar.


However, it is necessary, at runtime to read a rule from the DB and
check some value string against the rule to make sure that it is valid.


For example:


-------------------------------
DIR_PATH rule:


out=<path>;
path=<start>+[<dirs>]+[<slash>];
start=<dosdrv>|<Str[1,,anfw]>;
dosdrv=<Str[1,1,a]>+':';
dirs=<slash>+<Str[1,,anfw]>+[<dirs>];
slash='/'|'\';


DIR_PATH example value:


C:\Test Path\Test File_Name.ext


-------------------------------


Are there any C++ tools that will allow me to parse these rule/data
sets at runtime?


Thanks


Stuart Smith
[Assuming your grammar is fixed, any parser generator such as yacc will
generate a C callable parser. -John]



Post a followup to this message

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