Eli   Documents

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 Scope Graphs
 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


Messages on Scope Rule Violations

Erroneous programs may violate the scope rules in one of two cases:

  • A particular applied identifier occurrence has no valid defining identifier occurrence.

  • An identifier in a range may have more one defining occurrences.

Such situations shall be indicated by error messages. Furthermore, we want every defining occurrence of a multiply defined identifier to be marked by a message.

For that purpose we use the following two library modules:

CoreChk.specs[9]==

$/Tech/Strings.specs
$/Prop/OccCnt.gnrc:inst
This macro is attached to a product file.

The Strings module provides a function that concatenates an error message string and an identifier for error messages related to identifiers, see String Concatenation of Specification Module Library: Common Problems.

The OccCnt module provides computations that count how often an object identified by a Key attribute occurs in a certain context, in our case in a defining context. See Count Occurrences of Objects of Specification Module Library: Properties of Definitions, for more information.

The check for existence of a definition is directly obtained from the module role ChkIdUse. For the second check we specify a computational role ChkUnique in order to reuse it for several grammar symbols. If an object occurs more than once in the ChkUnique context it is multiply defined.

CoreChk.lido[10]==

SYMBOL ChkUnique INHERITS Count, TotalCnt COMPUTE
  IF (GT (THIS.TotalCnt, 1),
  message (ERROR, CatStrInd ("identifier is multiply defined: ",
                             THIS.Sym),
           0, COORDREF));
END;

SYMBOL UseIdent INHERITS ChkIdUse END;
SYMBOL DefIdent INHERITS ChkUnique END;
This macro is attached to a product file.


Previous Chapter Next Chapter Table of Contents