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

Abstract data types to be used in specifications

Previous Chapter Next Chapter Table of Contents


Mapping Arbitrary Values To Definition Table Keys

This module implements mappings from values of an arbitrary type (specified by a generic instantiation parameter) to unique definition table keys. It is instantiated by

   $/Adt/Table.gnrc +instance=NAME +referto=TYPE :inst
where NAME identifies the table instance and TYPE is the type of the values being mapped to definition table keys.

Note: if TYPE is not a type that is predefined in C then its definition must be made available by some .head specification.

Each table is implemented by a dynamically allocated memory with a 32-bit address space. The user must supply a hash function to compute a 32-bit value that characterizes a given TYPE value. If TYPE is representable in 32 bits, then this function is simply an identity function that casts the given value to type ub4 (representing an unsigned 32-bit value). Otherwise the general hash function available in the Eli library can compute an appropriate value (see Computing a Hash Value of Solutions of common problems).

Each element of the memory may hold more than one table entry; the user must supply a comparison function to verify that a particular table entry is the one sought. If TYPE values are ordered, this function should return an integer less than, equal to, or greater than zero when its first TYPE argument is less than, equal to, or greater than its second. Otherwise, the function must return zero if its TYPE arguments are equal, and an integer greater than zero if they are unequal.

The following functions are supplied by the module:

void NAMEInitTable (ub4 (*hash)(TYPE), int (*cmp)(TYPE, TYPE))
Initializes the table. hash is the hash function on TYPE values, and cmp is the comparison function on TYPE values.

DefTableKey NAMEKeyInTable (TYPE v)
Yields the definition table key associated with the value v. If there is no definition table key associated with the value v then NAMEKeyInTable yields NoKey.

DefTableKey NAMEDefInTable (TYPE v)
Yields the definition table key associated with the value v. If there is no definition table key associated with the value v then NAMEDefInTable associates the value v with a new definition table key and yields that key.
These functions can be used in specifications of type .lido, .init, .finl, and .con. They can also be used in .pdl specifications or in C modules if the interface file NAMETable.h is imported there.


Previous Chapter Next Chapter Table of Contents