Code generation

Top  Previous  Next

 

In the professional version of the TextTransformer you can export source code for a c++ class of the created parser. Beneath the advantage of the faster execution of the parser as compiled c++ code, this feature has the advantage that such code is not limited to the sub-set of c++, which the interpreter offers.

 

In the introduction already was explained, that a production could be considered as a specification for the creation of o function. The generation of code now is the application of this specification, i.e. for each production an according function will be built.

 

The c++ code for the semantic actions hereby is written into the generated code, according to the project option, simply by copying or by reconstruction. The code for the parser will be written at indicated positions in a code frame. These frames can be adapted individually for each project to the desired aims. There is

 

1. a frame for the header and

2. a frame for the implementation

 

of the parser class.

 

To compile a parser generated by the TextTransformer you need the library of regular expressions from Dr. Maddock and the code of some classes, which are delivered together with the professional version of the TextTransformer:

 

CTT_Error

CTT_ParseError

CTT_Parser

CTT_ParseState

CTT_Scanner

CTT_Tst

CTT_Match

CTT_Guard

 

 

An implementation of the helping functions  

 

stod

stoi

dtos

itos

etc.

 

can be found in tt_lib.h/cpp

 



This page belongs to the TextTransformer Documentation

Home  Content  German