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 Type Analysis

Previous Chapter Next Chapter Table of Contents


Basic Scope Rules

The basic task of name analysis is consistent renaming. For each identifier occurrence a Key attribute is computed such that identifier occurrences that refer to the same object in the program have the same Key attribute value. Hence Keys identify program objects uniquely. Keys are used to associate properties to program objects and to retrieve those properties in different contexts.

For the kernel language we distinguish the following identifier occurrences:

Scope.con[5]==


DefIdent:       Ident.
UseIdent:       Ident.
TypeUseIdent:   Ident.

This macro is attached to a product file.

The scope rules of a language determine how identifier occurrences are bound to program objects. We specify Algol-like scope rules for our language. The basic Algol-like scope rule reads:

A definition of an identifier a is valid in the whole smallest range that encloses that definition, except inner ranges that contain another definition of a.

Hence, a definition in an outer range is hidden by a definition of the same identifier in an inner range for the whole inner range. Identifiers may be applied before they are defined.

We instantiate a library module that provides computations according to this scope rule:

CoreScope.specs[6]==


$/Name/AlgScope.gnrc:inst

This macro is attached to a product file.

The use of that module requires that every identifier occurrence has the attribute Sym representing the identifier encoding. Hence we specify a computational role IdentOcc that provides that attribute, and will be inherited to any identifier occurrence.

The computational roles RangeScope, IdDefScope, and IdUseEnv are associated to the corresponding symbols of our grammar.

CoreScope.lido[7]==


TERM Ident: int;
ATTR Sym: int;
CLASS SYMBOL IdentOcc COMPUTE SYNT.Sym = TERM; END;

SYMBOL Block    INHERITS RangeScope END;
SYMBOL DefIdent INHERITS IdDefScope, IdentOcc END;
SYMBOL UseIdent INHERITS IdUseEnv, IdentOcc END;
SYMBOL TypeUseIdent INHERITS IdUseEnv, IdentOcc END;

This macro is attached to a product file.


Previous Chapter Next Chapter Table of Contents