Features & Notes

GIGL uses C++ like object-oriented program language style to encode grammatical PCGs, and is compatible with almost all of C++ syntax (some nuances exists due to undesired implementation artifacts). A typical outline of GIGL code is shown below.

A typical outline of GIGL code

    • The most important two parts of GIGL, in terms of language constructs, is the item type definition part (starting with the keyword gigltype), and the generator configuration (at the end of the generate ... with ... part). The data structure defined by an item type is illustrated at [Here], and the syntax for item type definition starts at [Here]. The generator configuration is further discussed at [Here], and its syntax is at [Here].

    • Item type definition contains different types of blocks similar to the style of a C++ class definition, the wrapper and node blocks are mainly for defining attributes (see [Here] for details), and the nonterminal and rule blocks are mainly for defining the item grammar (see [Here] for details).

    • In terms of a typical GIGL source file, it often contains an item type definition, and C++ interface(s) containing item generator call(s) that takes some generator configuration(s). As the figure above shows. However, this is only a simple, typical outline, many details can vary, including but not limited to:

      • Many other small components may be added, such as options, parameters, etc.

      • The interfacing function signature can vary, as long as it passes the information about the generated item as C++ object in some way, it is reasonable (e.g. with pointers in the arguments instead of as the return value etc.).

      • Interfacing function is needed only because we want other pure C++ source file be able to directly compile with the GIGL source. If a the main function is in this GIGL file and there is no other C++ file that needs interaction with the GIGL file, then there is no need to specifically create a C++ interface.