Variables

AssignmentOperator declares, assigns and updates variables, arrays and records in plab. Several assignments can be executed in a single AssignmentOperator. Once assigned, a variable can be evaluated by all nodes executed after it, not only subsequent nodes.

Assignments use a notation split into three parts: The first states the name of the variable, the second states the type, the third gives the value to assign. Valid types are int and double. Arrays can be created by appending the array size in [] braces. It is possible to give the size of the array using a function. These types can be compounded to records. Records can be used without declartion. Assigning a value to a.b automatically creates a record a with member b.

Almost all node attributes can evaluate variables in formulas in infix notation.

Previous Chapter: Traversal rules
Next Chapter: Calls & Recursions
Main Page: Home