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


A Second Name Space

The scope rules of some languages define several distinct name spaces, i.e. the identifier occurrences in one name space do not affect bindings in another name space. In C, for example, variable identifiers and label identifiers belong to different name spaces.

We demonstrate that aspect by introducing a special kind of variable to our language. Such variables are set by a special statement, and accessed by special operands. Hence, the identifier occurrences are syntactically distinguished from identifier occurrences of the name space used so far.

Flat.con[18]==

Statement:      'set' CtrlVarUse 'to' Expression ';'.
Operand:        'use' CtrlVarUse.
CtrlVarUse:     Ident.
This macro is attached to a product file.

We use another instantiation of the scope rule library module to specify the scope rules for the second name space, and require test output for it:

Flat.specs[19]==

$/Name/AlgScope.gnrc+instance=CtrlVar:inst
$/Name/ShowBinding.gnrc+instance=CtrlVar:inst
This macro is attached to a product file.

The instance parameter is set to CtrlVar to distinguish the module instance from the one for the first name space.

We demonstrate another variant of scope rules for our new CtrlVar name space: There is no nesting of ranges, i.e. the Program is the only range of a flat name space. Furthermore, identifiers are implicitly defined by using them. Hence, there is only one kind of identifier occurrences. It has the role of a defining occurrence (CtrlVarIdDefScope), i.e. a new object key is created, if the identifier is not yet bound.

Flat.lido[20]==

SYMBOL Source  INHERITS CtrlVarRangeScope END;
SYMBOL CtrlVarUse INHERITS CtrlVarIdDefScope, IdentOcc END;
This macro is attached to a product file.

Since we allow the use of CtrlVar before it is set, these scope rules can not be violated. Hence, we do not need any checks or messages.


Previous Chapter Next Chapter Table of Contents