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

Name analysis according to scope rules

Previous Chapter Next Chapter Table of Contents


Joined Ranges

In some situations it is not possible to specify the tree grammar such that each range in the sense of scope rules is rooted by one single grammar symbol as required for using the role RangeScope of the basic scope module. The following three modules extend the basic scope rule modules (see Basic Scope Rules) by facilities that support such cases:

AlgRangeSeq
Joined Ranges Algol-like
CRangeSeq
Joined Ranges C-like
BuRangeSeq
Joined Ranges C-like Bottom-up

Using one of these modules requires that the corresponding basic scope rule module is instantiated with the same generic parameters +instance=NAME and +referto=KEY.

This module implements the following concept: Several ranges in the program form one single range in the sense of scope rules, i.e. the definition in these ranges contribute to a single scope in which the applied identifier occurrences of these ranges are bound. There is a symbol which is the subtree root for all these ranges. But it is not a range in the sense of scope rules because it may also contain identifier occurrences that are bound in the enclosing range.

The modules provide .lido specifications for the following computational roles:

NAMERangeSequence is to be inherited by a symbol that is the root of a subtree which contains all to be joined ranges. It provides all attributes provided by NAMERangeScope, but it is not a range in the sense of scope rules. Other range roles may not be inherited by NAMERangeSequence.

NAMERangeElement is the role to be inherited by symbols that represent ranges to be joined. It is a specialized NAMERangeScope. Other range roles may not be inherited by such a symbol. It is a specialized NAMERangeScope that must be contained in a NAMERangeSequence subtree without having a NAMERangeScope in between.

We demonstrate the use of these facilities by extending the language of our running example by introducing an artificial language construct: It consists of a defining identifier occurrence, that is to be bound in the enclosing range, and two compound statements which form one single range in the sense of scope rules:

   Statement:      Join.
   Join:           'join' DefIdent JoinedBlock JoinedBlock 
                   'joined' ';'.
   JoinedBlock:    Compound.

Hence the Join symbol has the role RangeSequence, and the JoinedBlock symbol has the role RangeElement:

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

   SYMBOL Join INHERITS RangeSequence END;
   SYMBOL JoinedBlock INHERITS RangeElement END;

This example is applicable with either the AlgRangeSeq module or the CRangeSeq. In case of Algol-like scope rules an applied identifier occurrence in either of the two ranges may be bound to a definition in either of the two ranges. In case of C-like scope rules an applied identifier occurrence in the second of the two ranges may be bound to a definition in either of the two ranges.

In case of bottom-up computations using the BuRangeSeq module some modifications have to be applied as described for that module.

Joined Ranges Algol-like

This module implements joined ranges for Algol-like scope rules as described in (see Joined Ranges).

The module is instantiated by

   $/Name/AlgRangeSeq.gnrc+instance=NAME +referto=KEY :inst

Using this module requires that the module AlgScope is instantiated with the same values of the generic parameters.

The module provides the computational roles NAMERangeSequence and NAMERangeElement as described in See Joined Ranges.

Joined Ranges C-like

This module implements joined ranges for C-like scope rules as described in (see Joined Ranges).

The module is instantiated by

   $/Name/CRangeSeq.gnrc+instance=NAME +referto=KEY :inst

Using this module requires that the module CScope is instantiated with the same values of the generic parameters.

The module provides the computational roles NAMERangeSequence and NAMERangeElement as described in See Joined Ranges.

Joined Ranges C-like Bottom-up

This module implements joined ranges for C-like scope rules as described in (see Joined Ranges). Its computations are executed BOTTOMUP while the input is read.

The module is instantiated by

   $/Name/BuRangeSeq.gnrc+instance=NAME +referto=KEY :inst

Using this module requires that the module BuScope is instantiated with the same values of the generic parameters.

The module provides the computational roles NAMERangeSequence, NAMEOpenSeqScope and NAMEOpenElemScope.

NAMERangeSequence is to be inherited by a symbol that is the root of a subtree which contains all to be joined ranges. It provides all attributes provided by NAMERangeScope, but it is not a range in the sense of scope rules. Other range roles may not be inherited by NAMERangeSequence.

NAMEOpenSeqScope is to be inherited by a symbol that is in the subtree of NAMERangeSequence and precedes all to be joined ranges.

NAMEOpenElemScope is to be inherited by a symbol that precedes each to be joined range.

A nested NAMERangeSequence may not occur between NAMEOpenSeqScope and the first
NAMEOpenElemScope.

The example given in See Joined Ranges is here modified for the bottom-up case.

We demonstrate the use of these facilities by extending the language of our running example by introducing an artificial language construct: It consists of a defining identifier occurrence, that is to be bound in the enclosing range, and two compound statements which form one single range in the sense of scope rules.

We introduce two new symbols BuJoin and BuJoinEl that derive to empty.

   Statement:      Join.
   Join:           'join' BuJoin DefIdent 
                          BuJoinEl Block BuJoinEl Block 
                   'joined' ';'.
   BuJoin:         .
   BuJoinEl:       .

The module roles are inherited as described above:

   RULE: Join ::= 'join' BuJoin DefIdent 
                         BuJoinEl Block BuJoinEl Block
                  'joined' ';'
   END;

   SYMBOL Join INHERITS RangeSequence END;
   SYMBOL BuJoin INHERITS OpenSeqScope END;
   SYMBOL BuJoinEl INHERITS OpenElemScope END;
   SYMBOL Block INHERITS RangeScope END;


Previous Chapter Next Chapter Table of Contents