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

Library Reference

Previous Chapter Next Chapter Table of Contents


Source Text Coordinates

#include "coord.h"

typedef POSITION *CoordPtr;

POSITION NoCoord;
CoordPtr NoPosition;

int LineOf(POSITION);
int ColOf(POSITION);
int RLineOf(POSITION);
int RColOf(POSITION);

int LineNum;
POSITION curpos;

int earlier(CoordPtr p, CoordPtr q)

This module implements a source text coordinate system for an abstract syntax tree. A value of type POSITION attached to an abstract syntax tree node locates the source text phrase that is represented by that node. By default, the value specifies the coordinates of the first character of the phrase as a pair (line index, column index). LineOf and ColOf are access functions for the elements of the pair; they may be used either to read or to set these elements.

If the C pre-processor symbol RIGHTCOORD is defined, each POSITION value additionally specifies the coordinates of the first character beyond the source text phrase represented by the node. The access functions for the additional elements are RLineOf and RColOf.

LineNum and curpos are variables provided by the coordinate module for the use of its clients. LineNum initially has the value 1. It is neither read nor set by the coordinate module. The initial value of curpos is undefined, and it is also neither read nor set by the coordinate module.

The earlier function is called to compare two positions. If p precedes q in the source text then earlier returns the value 1; otherwise earlier returns the value 0. When the C pre-processor symbol RIGHTCOORD is defined, earlier returns 1 if phrase p precedes phrase q and the two do not overlap.


Previous Chapter Next Chapter Table of Contents