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


Joined Ranges

In our language subtrees rooted by a Block symbol exactly cover a range of the program in the sense of the scope rules. Hence, we could simply associate the role RangeScope with Block above.

However, there are situations where a range in the sense of the scope rules extends over several subtrees, but their common root can not be taken as the scope range. Such a situation occurs for example in Pascal, where the formal parameter list of a procedure and the procedure body form a single range.

The join statement below demonstrates such a situation. It consists of two blocks which together shall form one range in the sense of the scope rules. I. e. any definition in each of the blocks is valid in both of them. But the identifier after the join symbol is defined in the enclosing range.

Join.con[15]==

Statement:      Join.
Join:           'join' DefIdent JoinedBlock JoinedBlock 'joined' ';'.
JoinedBlock:    Compound.
This macro is attached to a product file.

We could modify the grammar in order to get a single symbol representing that range. But that may not be desirable due to parsing reasons. The problem is solved by the following technique:

A symbol, here Join, is identified such that it contains both ranges. It has the module role RangeSequence, which does not constitute a range in the sense of scope rules. Hence the DefIdent belongs to a range that encloses the statement.

The symbol JoinedBlock has the module role RangeElement. The two JoinedBlock below the Join symbol then form a range in the sense of scope rules.

The roles RangeSequence and RangeElement are obtained from the library module AlgRangeSeq, see See Joined Ranges of Specification Module Library: Name Analysis.

Join.specs[16]==

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

Join.lido[17]==

RULE: Join ::= 'join' DefIdent JoinedBlock JoinedBlock 
               'joined' ';'
END;

SYMBOL Join INHERITS RangeSequence END;
SYMBOL JoinedBlock INHERITS RangeElement END;
This macro is attached to a product file.


Previous Chapter Next Chapter Table of Contents