Item Type Declaration

Declaration :=

| 'gigltype' Identifier_t '{' ConfigParamList '}' ':' GiglOptionSetting '{' GigltypeBlockList '}' ';'

| 'gigltype' Identifier_t '{' '}' ':' GiglOptionSetting '{' GigltypeBlockList '}' ';'

| 'gigltype' Identifier_t ':' GiglOptionSetting '{' GigltypeBlockList '}' ';'

| 'gigltype' Identifier_t ';'

These are bridging productions from the nonterminal Declaration in C, which defines/declares a data type for the items to be generated with GIGL (called an item type). The first production contains all possible components; the second and third are two variants for the case where there are no ConfigParamList part; the last production is a pure declaration (with no definition/implementation).

  • Identifier_t is a terminal in C that matches any valid identifier, which is the item type name here.

    • ConfigParamList is a nonterminal for declaring a list of configure parameters, syntax-wise it is like declaring a list of parameters for functions in C, except that parameter names must be present and no variadic is allowed; here they are item level configure parameters.

  • GiglOptionSetting is a nonterminal for the item type options.

  • GigltypeBlockList (see below) is a nonterminal for the list of blocks as the body of the type definition (like those in a class definition).

GigltypeBlockList :=

| GiglWrapperDeclList

| GigltypeBlockList 'wrapper' ':' GiglWrapperDeclList

| GigltypeBlockList 'node' ':' GiglNodeDeclList

| GigltypeBlockList 'nonterminal' ':' GiglNtDeclList

| GigltypeBlockList 'rule' ':' GiglRuleDeclList

These are productions from the nonterminal GigltypeBlockList, which effectively expands to a list of blocks with four different types, wrapper, node, nonterminal and rule. This is very similar to the C++ class definition where there are private, protected, and public blocks. The first production indicates that there could be an unlabeled block at the beginning which defaults to a wrapper block (analogous to the default private block in C++).