Node Block

GiglNodeDeclList :=

| <empty>

| GiglNodeDeclList ';'

| GiglNodeDeclList StructDeclaration

| GiglNodeDeclList GiglNodeFuncDef

GiglNodeFuncDef := SpecifierQualifierList Declarator CompoundStatement

These sets of productions starting from the nonterminal GiglNodeDeclList, which is the content in a node 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. Note that the actual implementation is a little different (and looks much more complicated) because of the special treatments we does to variable attributes and functinal attirbutes, but here we give the rough idea and syntax (the actual implementation may change in the future).

StructDeclaration is for the declaration of a node variable attribute or function attribute. It looks like a struct member variable in C except that pure function declaration also makes sense here. If it is a variable, a variable of the same name and type is added to the wrapper class and the value will be copied from the root node to the wrapper at the end of the generator and constructor. If it is a function, a function of the same name and type is added to the wrapper class, which, when called will call the copy in the root node with parameter passed down unchanged. Function parameter declaration uses a nonterminal ConcreteParamList which requires parameter names to be present and no variadic is allowed.

GiglNodeFuncDef is for the definition of a node functional attribute. It looks like an inlined class member function in C++. It means that any node (any nonterminal types to be expanded by any rule) uses this definition for the functional attribute unless overridden. As mentioned above, a function of the same name and type is added to the wrapper class, which, when called will call the copy in the root node with parameter passed down unchanged; function parameter declaration uses a nonterminal ConcreteParamList which requires parameter names to be present and no variadic is allowed.

  • 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 later).

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