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

Frequently Asked Questions and Answers

Previous Chapter Next Chapter Table of Contents


How to solve common problems in Eli


Is there Support for Intermediate Code in Eli?

> Does Eli support the generation of intermediate code and if so, what
> type of code and in which way?

In general, Eli supports generation of intermediate code in the same way that it supports the generation of any kind of code: You write a PTG specification of the language to be output and invoke the routines to build up your output.

If you want to specify the intermediate language as a tree and perform some attribute computation over it without writing it out and reading it back in, then you can specify the tree in LIDO. Eli produces Mk functions from a LIDO specification much the same way as it produces PTG functions from a specification. You invoke the Mk functions to build your tree and then paste it into the original tree built by the parser. See Computed Subtrees of LIDO - Reference Manual, for details. You can see an example using an intermediate language appropriate to the Spim simulator for the MIPS at http://ece-www.colorado.edu/~ecen4553/HW/ctgt.html.

If you want to target an existing intermediate representation that is implemented as a class library (like Suif, for example), then you make the class library available as a part of your specification (usually via a .a file) and invoke its methods directly from your translation specification just like you would invoke PTG or Mk functions.


C++

>   Is there an ELI-generated compiler available for C++?

There is none that I know of. One reason is that C++ seems to be defined not by a standard but by a collection of front ends. Particular users are partial to particular front ends, and are not interested in a compiler that actually conforms to either the ARM or the draft ANSI standard. This situation might change, but in the interim there seems to be little point in building an Eli specification.

Compounding the problem is the fact that C++ has a number of essential ambiguities that make it very difficult to specify formally. For example, if something looks like both a declaration and an expression then it's a declaration. How do you express that formally?


How does recognition of delimiters work in Eli?

> I want to use ':=' in the grammar to represent three notations
> ':=', '=', and ':-'.

This could be done as follows (for an explanation of all of the relevant constructs, see Literal Symbols of Lexical Analysis):

@O@<foo.con@>==@{
S: 'A' ':=' 'B' .
@}

@O@<foo.delit@>==@{
$:=     ColonEqual
@}

@O@<foo.gla@>==@{
        $:=     [mkassign]
        $=      [mkassign]
        $:-     [mkassign]
@}

@O@<foo.c@>==@{
#include "litcode.h"
#include "eliproto.h"

void
#if PROTO_OK
mkassign(char *c, int l, int *t, int *s)
#else
mkassign(c, l, t, s) char *c; int l, *t; int *s;
#endif
{ *t = ColonEqual; }
@}


> For Pascal, :kwd has to be applied to the file that contains
> nothing else than the specification of Name: PASCAL_IDENTIFIER
> Is that the only possible application of :kwd?

The :kwd derivation is used to specify sets of literal terminals appearing in a grammar that should be recognized by looking them up in the identifier table rather than by incorporating them into the scanner's finite state machine. Mixed-case keywords are the most common use of :kwd, but it can also be used simply to cut down the size of the scanner tables at some cost in execution time.


How can I use external libraries with Eli?

Use +lib='mylib' to add the `-lmylib'' option to the link. +lib_sp can be used to supply a directory for the library (the -L option in the link).

You can also use the mechanism used by Eli internally, although it isn't really pretty. You can add a `.libs' file to your specification that has something of the form:

   / +lib_sp=(libdir) +lib='libname' :library_flags


> Is there also a way to tell Eli an include path for > header files?

There is a parameter called +cc_flags with which you can provide the -I option to the compilation.



Previous Chapter Next Chapter Table of Contents