Next: , Previous: , Up: Lexical Analysis   [Contents][Index]

10.1.5 Lexical Scoping

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:


The field values of an enum:

enum result {TRUE, FALSE, ERROR};

are referenced to by using the enum type name as scope:


A 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;

All definitions in a behavior are local to that behavior and cannot be referenced from outside it13,


A 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 (): ();

An 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;
    hello h;
    sp <=> h.p;
    h.r <=> sr;

Types 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: , Previous: , Up: Lexical Analysis   [Contents][Index]