General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Frequently Asked Questions and AnswersHow 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,
The
How can I use external libraries with Eli?
Use 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
|