Generation Script Structure
Typically, a generation script has the following structure:
-
Parser directives
-
Declarations
-
Constants
-
Data patterns
-
Global generation settings
-
Packet/structure templates
-
Global numeric variables
-
Global structure variables (declare a template for a variable before declaring a variable)
-
Aliases
-
-
Generation procedures
-
List of generation instructions
-
Global declarations (constants, data patterns, templates, aliases)
-
Note: The parser can use previously declared objects in later declarations. In generation procedures, the parser can use global objects before their declaration as long as such objects are finally declared outside of generation procedures.
Reminder: The generation parser is NOT case-sensitive.
Main Procedure and Other Procedures
Although you can create many generation procedures, the major execution entry point is a procedure with the name Main. Therefore, you must have a generation procedure named Main. You can invoke the other generation procedures in the Main generation procedure using the Call directive.
The Call directive makes a "dynamic" insertion, in which the included procedure is re-parsed using the new parser variable values and the latest values of global variables.