Wrapper Block

GiglWrapperDeclList :=

| <empty>

| GiglWrapperDeclList ';'

| GiglWrapperDeclList StructDeclaration

| GiglWrapperDeclList GiglWrapperFuncDef

| GiglWrapperDeclList GiglWrapperGenDef

| GiglWrapperDeclList GiglWrapperConDef

| GiglWrapperDeclList GiglWrapperGenConDef

| GiglWrapperDeclList GiglWrapperDesDef

GiglWrapperFuncDef := SpecifierQualifierList Declarator CompoundStatement

GiglWrapperGenDef := 'generator' CompoundStatement

GiglWrapperConDef := 'constructor' CompoundStatement

GiglWrapperGenConDef := 'gencontor' CompoundStatement

GiglWrapperDesDef := 'destructor' CompoundStatement

These sets of productions starting from the nonterminal GiglWrapperDeclList, which is the content in a wrapper block. It contains a list (maybe empty) of entries (definitions/declarations) each of which may optionally be followed by extra ';'s. Different types of entries are discussed below.

StructDeclaration is for the declaration of wrapper variable attribute(s) declaration. It looks like a struct member variable in C.

GiglWrapperFuncDef is for the definition of a wrapper functional attribute. It looks like a class member function in C++.

GiglWrapperGenDef is for item generator definition. The part that is after the keyword is like a function body and it will be executed when the item generator is called. Multiple generator bodies will be concatenated (within the same wrapper block or across multiple wrapper blocks) and the statements are executed in the order they are defined (generator-constructor body will also be counted). If overall there is no statement that assigns to the 'root' pointer, a default node generator call of the first nonterminal type (with no arguments) will be used to expand the root before other generator statements are called.

GiglWrapperConDef is for item constructor definition. The part that is after the keyword is like a function body and it will be executed when the item constructor is called. Multiple constructor bodies will be concatenated (within the same wrapper block or across multiple wrapper blocks) and the statements are executed in the order they are defined (generator-constructor will also be counted).

GiglWrapperGenConDef is for item generator-constructor (or abbreviated as 'gencontor') definition. The part that is after the keyword is like a function body and it will be executed when the item generator or constructor is called. Multiple gencontor bodies will be concatenated (within the same wrapper block or across multiple wrapper blocks) and the statements are executed in the order they are defined (the position for them to be inserted in other generator or constructor bodies are also from the order they are defined).

GiglWrapperDesDef is for item destructor definition. The part that is after the keyword is like a function body and it will be executed when the item destructor is called (i.e. when the object of the wrapper class is deleted). Multiple destructor bodies will be concatenated (within the same wrapper block or across multiple wrapper blocks) and the statements are executed in the order they are defined. If overall there is no delete on the 'root' pointer, a default delete operation on the 'root' pointer (will check against nullptr) will be added to the end.

  • SpecifierQualifierList is a nonterminal in C for a type ('int', 'float' etc.) along with its qualifers ('static', 'const' etc.). Here it is used for the wrapper functional attribute (a function) return type (not including modifiers like pointers).

  • Declarator is a nonterminal in C for an variable or function identifier with this modifiers. Here it is used for the wrapper functional attribute (a function) identifier with its modifiers (including the arguments and the modifiers on the return type, but not the return type itself).

  • StructDeclaration is a nonterminal in C for an entry defines member(s) for structs. Here it is used to defined wrapper attributes. Pure function definition may also match but is not intended (may adjust in the future).

  • CompoundStatement is a nonterminal in C for a list of statements with '{' and '}' (included) wrapped around.