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

LIDO - Reference Manual

Previous Chapter Next Chapter Table of Contents


Inheritance of Computations

A set of related computations can be associated with a CLASS symbol describing a certain computational role. It can be inherited by TREE symbols or by other CLASS symbols, thus specifying that they play this role and reusing its computations. A symbol can play several roles at the same time (multiple inheritance). Inherited computations can be overridden by other computations of attributes having the same name. CLASS specifications have the same notation and meaning as SYMBOL specifications.

Syntax

    Specification ::= SymbKind SymbName [ Inheritance ]
                       Computations 'END' ';'
    Inheritance   ::= 'INHERITS' SymbNames


Example:

      CLASS SYMBOL RootSetLine COMPUTE
        SYNT.GotLine = CONSTITUENTS KeySetLine.GotLine;
      END;

      CLASS SYMBOL KeySetLine COMPUTE
        SYNT.GotLine = ResetLine (THIS.Key,LINE);
      END;

      CLASS SYMBOL KeyPrintLine COMPUTE
        printf ("identifier in Line %d defined in line %d\n",
                LINE, GetLine (THIS.Key,o))
           <- INCLUDING RootSetLine.GotLine;
      END;

      SYMBOL VarDefId  INHERITS KeySetLine   END;
      SYMBOL ProcDefID INHERITS KeySetLine   END;
      SYMBOL UseIdent  INHERITS KeyPrintLine END;
      SYMBOL Program   INHERITS RootSetLine  END;

CLASS computations obey the same rules as symbol computation.

The sets of lower and upper class computations may be accumulated from several CLASS specifications for the same class.

CLASS computations may be inherited by TREE symbols or by other CLASS symbols.

A CLASS or a TREE symbol Target inherits the computations from a CLASS Source if there is a Target INHERITS Source relation specified. The complete inheritance relation is accumulated by all INHERITS specifications.

A computation is inherited only once even if there are several paths to it in the inheritance relation.

A computation for an attribute a associated with a CLASS or a TREE symbol overrides any computation for a inherited from a CLASS symbol.

Note: Plain computations can not be overridden.

The computations inherited by a CLASS symbol belong to the computation sets of the CLASS symbol and may be subject to further inheritance.

Restrictions

TREE symbols and CLASS symbols may not inherit from TREE symbols.

The inheritance relation must not be cyclic.

If C inherits from CLASS symbols C1 and C2, and if both C1 and C2 have computations for an attribute a, it is undefined which one is inherited by C.


Previous Chapter Next Chapter Table of Contents