Posted By:
Michael_Lindig
Posted On:
Wednesday, March 21, 2001 10:47 PM
Hi, in the actual release of ANTLR the produced cpp code for a parser which are defined as: class SubParser extends SuperParser; includes all rules of SuperParser. A better solution is: Generate the parser output files for SuperParser as normal. SubParser should inherit from SuperParser instead of LLkParser: class SubParser : public SuperParser The rules from SuperParser should be included as: public: void a_SuperParser_Rule() { // include some trace rules SuperParser::a_SuperParser_Rule(); } The trace options shall only be valid for a
More>>
Hi,
in the actual release of ANTLR the produced cpp code for a parser which are defined as:
class SubParser extends SuperParser;
includes all rules of SuperParser.
A better solution is:
Generate the parser output files for SuperParser as normal.
SubParser should inherit from SuperParser instead of LLkParser:
class SubParser : public SuperParser
The rules from SuperParser should be included as:
public: void a_SuperParser_Rule()
{
// include some trace rules
SuperParser::a_SuperParser_Rule();
}
The trace options shall only be valid for actual grammar file this means trace statements should only be included for SubParser.
If no super grammar specified then all undefined rules shall be generated as SuperParser rule.
What do You think about that ? It is possible or not ? Make it sense ?
Michael
<<Less