General Information

 o Eli: Translator Construction Made Easy
 o Global Index
 o Frequently Asked Questions

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

Reference Manuals

 o User Interface
 o Eli products and parameters
 o LIDO Reference Manual

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

 Questions, Comments, ....

Tutorial on Type Analysis

Previous Chapter Next Chapter Table of Contents


Properties of Predefined Objects

In our language the type names int, real, bool, and void, and the names true and false for boolean values are predefined. They are introduced using the following library modules:

Predef.specs[10]==

$/Name/PreDefine.gnrc+referto=Ident:inst
$/Name/PreDefId.gnrc+referto=(Predef.d):inst

This macro is attached to a product file.

The following description defines a key for each of the predefined identifiers:

Predef.d[11]==

PreDefKey ("int", intKey)
PreDefKey ("real", realKey)
PreDefKey ("bool", boolKey)
PreDefKey ("void", voidKey)
PreDefKey ("true", trueKey)
PreDefKey ("false", falseKey)

This macro is attached to a product file.

As we are going to use the library module Typing to support type analysis we have to adopt its strategy for representing types:

Types are represented by DefTableKeys. Such a key is created for each program construct which denotes a particular type, and for each predefined type, i. e. the keys intType, etc. below. The property IsType distinguishes them from non-type objects. These type keys have to be different from the keys associated to the predefined type names, intKey, etc. The former are associated to the latter via the property Defer. This technique allows the module roles to also deal with type definitions, and allows different type names stand for the same type.

PredefTypes.pdl[12]==


intType -> IsType = {1};
realType -> IsType = {1};
boolType -> IsType = {1};
voidType -> IsType = {1};

intKey -> Defer = {intType};
realKey -> Defer = {realType};
boolKey -> Defer = {boolType};
voidKey -> Defer = {voidType};

This macro is attached to a product file.

Typed objects, like variables, have the property TypeOf that represents their type. Hence, we associate that property with the predefined names for boolean values:

PredefConsts.pdl[13]==


trueKey -> TypeOf = {boolType};
falseKey-> TypeOf = {boolType};

This macro is attached to a product file.

Usually the properties TypeOf, Defer, and IsType are not set or accessed explicitly. Module roles ensure that they are properly used.


Previous Chapter Next Chapter Table of Contents