Next: Comments, Previous: Delimiters, Up: Lexical Analysis [Contents][Index]
A lexical scope adds locality to a name. Names in one lexical scope do not interfere (collide or shadow) with another scope. Referring to a scoped identifier
reference ::= scope* identifier scope ::= identifier "."
Dezyne defines the following scopes:
enumThe field values of an enum:
enum result {TRUE, FALSE, ERROR};
are referenced to by using the enum type name as scope:
result.TRUE
interfaceA type defined in an interface:
interface ihello
{
enum result {TRUE, FALSE, ERROR};
}
can be used in a component, e.g., to define a variable:
ihello.result status = ihello.result.TRUE;
behaviorAll definitions in a behavior are local to that behavior and cannot be referenced from outside it13,
portA port is an interface instance; events that are communicated over a port use the name of the port as their scope:
provides ihello p; … on p.hello (): p.world ();
instanceAn instance (or component instance), is an instance of a
component. A port defined in a component
component hello
{
provides ihello p;
requires ihello r;
}
can be referenced to by using the component instance name as their scope
component sys
{
provides ihello sp;
requires ihello sr;
system
{
hello h;
sp <=> h.p;
h.r <=> sr;
}
}
namespaceTypes defined in a namespace are referenced to by using the name of the namespace as their scope.
This may change when Dezyne gains support for hierarchical behaviors, a.k.a. submachines.
Next: Comments, Previous: Delimiters, Up: Lexical Analysis [Contents][Index]