Eli   Documents Get Eli: Translator Construction Made Easy at SourceForge.net.
    Fast, secure and Free Open Source software downloads

General Information

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

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
 o Typical Eli Usage Errors

Reference Manuals

 o User Interface
 o Eli products and parameters
 o LIDO Reference Manual
 o Typical Eli Usage Errors

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

Mail Home

Tutorial on Name Analysis

Previous Chapter Next Chapter Table of Contents


Scopes being Properties of Objects

Certain language constructs require that a set of bindings, i.e. a scope is associated as a property of an object. We demonstrate this facility by introducing modules to our language:

ScopeProp.con[21]==

Declaration:    'module' DefIdent ModBlock ';'.
ModBlock:       Compound.
Operand:        ModUseIdent '::' QualIdent.
ModUseIdent:    Ident.
QualIdent:      Ident.
This macro is attached to a product file.

Any object a declared in the ModBlock of a module m, but not in deeper nested Blocks, can be accessed by m::a wherever m is bound to that module. We say the identifier occurrence of a is qualified by m.

A library module (see Scopes Being Properties of Objects of Specification Module Library: Name Analysis) provides computational roles for scopes being associated with object keys:

ScopeProp.specs[22]==

$/Name/ScopeProp.gnrc:inst
This macro is attached to a product file.

The scope of the module body, with its local definitions, is associated as a property with the key representing the module. The role ExportRange of the library module characterizes such an association. ModBlock.ScopeKey is used to specify the key with which the scope property is associated.

ScopePropDef.lido[23]==

SYMBOL ModBlock INHERITS ExportRange END;

RULE: Declaration ::= 'module' DefIdent ModBlock ';' COMPUTE
  ModBlock.ScopeKey = DefIdent.Key;
END;
This macro is attached to a product file.

In binding a qualified identifier occurrence, QualIdent, the role QualIdUse is used to access the scope property associated with the ModUseIdent.Key and bind the identifier. The module computation provides a specification of QualIdent.Scope.

We assume that ModUseIdent indeed has an associated scope . An error message is issued if that assumption is violated, e.g. in the case of a variable identifier.

In addition, the roles used for applied identifier occurrences are associated.

ScopePropUse.lido[24]==

RULE: Expression ::= ModUseIdent '::' QualIdent COMPUTE
  QualIdent.ScopeKey = ModUseIdent.Key;

  IF (AND (NE (QualIdent.ScopeKey, NoKey),
           EQ (QualIdent.Scope, NoEnv)),
  message (FATAL, CatStrInd ("module or class identifier required: ",
                             ModUseIdent.Sym), 0, COORDREF));
END;

SYMBOL ModUseIdent INHERITS IdUseEnv, ChkIdUse, IdentOcc END;

SYMBOL QualIdent INHERITS QualIdUse, ChkQualIdUse, IdentOcc END;
This macro is attached to a product file.


Previous Chapter Next Chapter Table of Contents