|Grammar to automation translation at runtime (NOT at compile time)? firstname.lastname@example.org (2003-05-14)|
|RE: Grammar to automation translation at runtime (NOT at compile time) email@example.com (Quinn Tyler Jackson) (2003-05-16)|
|From:||Quinn Tyler Jackson <firstname.lastname@example.org>|
|Date:||16 May 2003 21:56:09 -0400|
|Posted-Date:||16 May 2003 21:56:09 EDT|
> Therefore, my question is if there is any thought/effort to make the
> grammar to automation (a computational service) make
> available at run
> time? I am interested in CFG based generators (current impls are
> JavaCC, ANTLR).
> If this would be possible, I just have to supply a grammar
> file at run
> time to validate an ASCII stream -- I do not have to make a
> at compile time. Only commitment I make that I will supply a valid
> grammar file to which the ASCII stream is validated (no nore grammar
> to Java/C# codegen/compile/write code on top of generated code).
> I took a look at Recursive Adaptive Grammar (which blurs the
> distinction between grammar vs automation) and it may hold certian
> potential towards dynamic grammar based validation.
Meta-S allows grammars to be instantiated at run-time from strings
(which could be stored in text files). The CLpmGrammar class has a
bool InstantiateFromString(const CShuString& ssGrammar, bool
So, for instance, if your grammar is saved as an .abn file, which in
flat ASCII, looks something like this:
S ::= A B C;
A ::= /* whatever */;
You do something like this:
CShuString ssGrammar = LoadFromFile("the_grammar.abn");
CShuString ssTestInput = LoadFromFile("test_input.txt");
// you can now traverse the parse tree
// grammar did not accept input
You can effectively do the above with the ABN2CPP utility (included
with Meta-S) thusly:
abn2cpp the_grammar.abn -i test_input.txt
You can develop your grammars either in a simple text editor, in
Meta-S Lite, or in Meta-S, a graphical grammar development environment
which allows you to debug the grammar against test input.
For more information, either visit http://www.meta-s.com or email me
Quinn Tyler Jackson
Return to the
Search the comp.compilers archives again.