[antlr-interest] Parsing dynamically defined templates ?

blade_x123 blade_x123 at yahoo.com
Wed Apr 30 18:43:38 PDT 2003


Hi,
 This may be a slightly long mail so please bear with me. In the file
format that I am trying to parse with antlr I have something called
Data Templates. These are defined at the beginning of each file, or
can also be a pre defined set. Here is an example

Template myTemplate {
DWORD myVar;
}
an instance of this template will look like this
myTemplate mT {
1.245;
}
also there can be array's which are comma seperated objects, as in
Template myArrayTemp {
array DWORD myArr[3];
}
which would be like
myArrayTemp {
1.0, 2.0, 3.0;
}
It gets more complicated :-(
a template can have an array of templates, for example
Template myTempArrTemp {
DWORD myVar;
array myArrayTemp bleh[3];
}
which would look like this
myTempArrTemp {
2.0;
1.0,2.0,3.0;,2.0,3.0,4.0;,5.0,6.0,7.0;;
}
the 2 semicolons at the end are needed to signify the end of a
template.

There are roughly 30-40 templates that are in common use. Also these
templates can be defined on the fly. How would I parse these ? A
general idea or tips would be helpful. I am assuming I have to do this
in my C++ code once I read in the template contents. Any ideas to
simplify my life ?

Thanks in advance,
Manju


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list