General Information

 o Eli: Translator Construction Made Easy
 o Global Index
 o Frequently Asked Questions

Tutorials

 o Quick Reference Card
 o Guide For new Eli Users
 o Release Notes of Eli
 o Tutorial on Name Analysis
 o Tutorial on Type Analysis

Reference Manuals

 o User Interface
 o Eli products and parameters
 o LIDO Reference Manual

Libraries

 o Eli library routines
 o Specification Module Library

Translation Tasks

 o Lexical analysis specification
 o Syntactic Analysis Manual
 o Computation in Trees

Tools

 o LIGA Control Language
 o Debugging Information for LIDO
 o Graphical ORder TOol

 o FunnelWeb User's Manual

 o Pattern-based Text Generator
 o Property Definition Language
 o Operator Identification Language
 o Tree Grammar Specification Language
 o Command Line Processing
 o COLA Options Reference Manual

 o Generating Unparsing Code

 o Monitoring a Processor's Execution

Administration

 o System Administration Guide

 Questions, Comments, ....

Tutorial on Name Analysis

Previous Chapter Next Chapter Table of Contents


Insertion of Scopes into the Environment Hierarchy

We now demonstrate how scopes obtained from object properties are inserted into the environment hierarchy given by the syntactically nested ranges. For this purpose we extend our module example.

We introduce a with statement that allows the components of a module to be used without qualification in the WithBody. (This construct is similar to the with statement in Pascal, where record variables are used instead of the module identifiers discussed here. It directly corresponds to the use construct in Ada.)

ScopeInsert.con[25]==


Statement:      'with' ModUseIdent 'do' WithBody.
WithBody:       Statement.

This macro is attached to a product file.

The WithBody is a special kind of range: The scope rule for our with statement require that the scope of the module stated by the ModUseIdent is inserted in the environment hierarchy between the scope of the WithBody and the environment formed by the range nest that encloses the with statement. I.e. a definition in a range enclosing the with statement may be hidden by a definition of the module; those definitions may be hidden within the WithBody. (In the case of our language the WithBody may not directly contain declarations, although deeper nested Blocks may contain such declarations.)

We use another library module (see Inheritance of Scopes of Specification Module Library: Name Analysis) to support such an embedding of environments:

ScopeInsert.specs[26]==


$/Name/AlgInh.gnrc:inst

This macro is attached to a product file.

The facility of inserting an environment obtained from a scope property of an object is provided by the module role RangeSnglInh. This role specializes RangeScope for single inheritance of a scope associated with RangeSnglInh.InhKey.

ScopeInsert.lido[27]==


SYMBOL WithBody INHERITS RangeSnglInh END;

RULE: Statement ::= 'with' ModUseIdent 'do' WithBody COMPUTE
  WithBody.InhKey = ModUseIdent.Key;
END;

This macro is attached to a product file.


Previous Chapter Next Chapter Table of Contents