EGL source code is a sequence of tokens, which
are the smallest units of meaning. At a more composite level, the
language includes the following constructs: type definitions, expressions,
statements, and set-values blocks.
The EGL tokens are as follows:
- Identifiers
- The names of parts, functions, variables, and constants. An example
is myCarCount, which might be a variable name. For
details, see “Naming conventions.”
- Literals
- Fixed values of a given type. Examples are the integer 5, the
string “yes!”, and the Boolean value TRUE. For details, see “Literals.”
- Operators
- Symbols that affect operands, which might be keywords,
identifiers, or literals. An operand is on the left or right of an
operator. For example, the < operator
is part of a condition that tests whether the operand on the left
has a lesser value than the operand on the right.
For details,
see “Operators and precedence.”
- Reserved words
- Identifiers that can be used only in a particular context. For
example, add is a statement name. For a
list, see “Reserved words.”
- Special characters
- Punctuation marks that divide tokens, as necessary for the parsing
done by the EGL compiler. For example, parentheses ((
)) surround a condition such (myVariable <
yourVariable).
For details, see “Special characters.”
At a more composite level, the language includes the following
constructs:
- Type definitions
- Sequences of tokens that define a part. Here is an example:
DataItem
NumberOfCars INT
End
For an overview, see “Overview of the classifiers.”
- Expressions
- Sequences of tokens that express unnamed instances. For example, 4
+ 5 might be assigned to a variable, but is itself a value
of type INT.
For details, see “Expressions.”
- Statements
- An instruction that causes work to occur at run time or that organizes
code at development and transformation time:
- The runtime work might be variable declaration, data manipulation,
logic invocation, input to (or output from) a user interface or persistent
data storage, and so forth.
- The organization work might include assigning types to packages,
importing types from other packages, and enabling a shortcut for referencing
identifiers that are in libraries.
Also valid is an empty statement: a semicolon (;) that stands
is in place of an instruction. You might use an empty statement as
a placeholder or for visual clarity.
Most statements begin with
an EGL keyword. For example, the following statement writes “yes!”
to the standard output:
SysLib.writeStdOut("yes!");
For
details, see “Statements table.”
- Set-values blocks
- Code areas that set annotations and field values and are delimited
by curly brackets ({}), as shown in the following declaration:
myCarCount NumberOfCars { InputRequired = yes, DisplayName = "Number of cars: " };
The
example set-values block assigns values to the InputRequired and DisplayName annotations
for the myCarCount variable.
Set-values blocks
are used in various ways in type definitions, statements, expressions,
and other set-values blocks. For details, see “Set-values blocks.”