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


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/AlgScopeProp.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 RangeScopeProp 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 RangeScopeProp 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 scope property associated with the ModUseIdent.Key is accessed, and the role IdUseScopeProp is used for QualIdent. This binding requires 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.Scope = GetScope (ModUseIdent.Key, NoEnv)
        <- INCLUDING RootScope.GotScopeProp;
END;

SYMBOL ModUseIdent INHERITS
        ChkModUseIdent,
        IdUseEnv, ChkIdUse, IdentOcc 
END;

SYMBOL QualIdent INHERITS
        IdUseScopeProp,
        ChkIdUse, IdentOcc
END;

CLASS SYMBOL ChkModUseIdent COMPUTE
  IF (AND (NE (THIS.Key, NoKey),
           EQ (GetScope (THIS.Key, NoEnv), NoEnv)),
  message (FATAL, CatStrInd ("module or class identifier required: ",
                             THIS.Sym), 0, COORDREF))
  <- INCLUDING RootScope.GotScopeProp;
END;

This macro is attached to a product file.


Previous Chapter Next Chapter Table of Contents