sarkar_soumen@yahoo.com (Soumen Sarkar) wrote in message news:03-05-085...> [snip...]> 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).

Code Worker is a scripting language distributed under LGPL
(http://codeworker.free.fr) that works on generative programming. It
allows building DSLs and their implementation, but also program
transformation, source-to-source translation, code generation and a
lot of other stuffs.

To acquire data, CodeWorker provides a declarative language for
describing the grammar of the data format: an extended BNF enriched of
some convenient directives. It allows just scanning, or scanning and
parsing together without binding to an external programming language
(such as C++/Java/C#).

> 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 commitment> 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).

CodeWorker doesn't work as an interpreter only. You can exploit the
CodeWorker's features via its C++ library. In C++, what you need is
(not tested):
...
#include "CppParsingTree.h"
#include "CGRuntime.h"
using namespace CodeWorker;

CppParsingTree_value aTree;
try {
CGRuntime::parseAsBNF("your-grammar-file.gen", aTree, "file-to-validate");
} catch(UtlException& error) {
std::cerr << error.getMessage() << std::endl;
}
...
In C, write a little library with a function that calls this piece of code.
In Java, use a little JNI. In C#, I don't know how it works, but it should be
possible too.