Compilers & Interpreters

jacques.menu@unige.ch
http://cui.unige.ch/DI/cours/CompInterpretes

 

 Uni-GE > Faculté des Sciences > CUI > Compilateurs & Interprčtes > Welcome

Search tools

Jacques Menu @ CUI

Useful links

Compilateurs & Interprètes

Compilers & Interpreters

Contrôle des études
Téléchargement
Bibliographie

contenu

Compilateurs avec C++

Jacques Menu
Addisson-Wesley, 1994
ISBN 2-87908-092-4

The Lista language
Download
Lista features
A Lista sample
Lista implementation

This site supports the Compilers & Interpreters course lectured by the author at the Faculté des Sciences of the University of Geneva, Switzerland, in its fall 2011 occurrence.

The Lista Language   top

This course relies on the implementation of the Lista language, both as a case study for the presentation and as the basis of the project assignment.

Lista evolved from Formula, whose implementation is described in French in Compilateurs avec C++.

A sample Lista program can be found below.

Download   top

The current Lista implementation (tar.gz) in version 2006-1.11 is available for you to use it, as well as

You can also download:

as well as various versions of the Doxygen-generated documentation:

Don't hesitate, and enjoy!

Lista features   top

Lista is a very simple language inspired from SML (http://www.smlnj.org//index.html), allowing the user to define and call functions in a very math-like syntax.
In particular:

  • Lista supplies numbers, booleans and strings;
  • there's no explicit typing: the language is statically strongly typed, and type inference is used to determine identifiers' types from their usage;
  • compiler options provide call by value, call by name and call by need (lazy evaluation) semantics for user function parameters;
  • there's a set of builtin constants and functions doing math, boolean operations and string manipulations.

Strangely enough, there are Strangely enough, there are NO lists in the language: this is left to the students' project.
The same holds for local variables, embedded functions and the like, that can be added at will. lists in the language: this is left to the students' project.

A Lista sample   top

A typical program showing the power of Lista and call by name/need is:

pbg4_jmi menu > ./ListaPDR -g -es -sb -l en NeverEnding.lista

Contents of source file 'NeverEnding.lista':
---------------------------------------------------------------

// A function that cannot be evaluated, whatever it's argument

NeverEnding (n) =

1 + NeverEnding (n + 1);

// A program that illustrates the virtues of call by name/need
// Call by value will just defeat it!

funct (m, n) =

If (

LessThan (m, 100),

m + 12,

n

);

? funct (3 + 5, NeverEnding (7));
---------------------------------------------------------------

Beginning direct evaluation...
Value:
       20.000000
-----------------

*** Direct evaluation time: 0 second(s) ***

*** Lista code lexically correct ***
*** Lista code syntactically correct ***
*** Lista code semantically correct ***

*** Pilum object code "NeverEnding.needPRD" has been created ***

*** Elapsed time: 0 second(s) ***

Lista implementation   top

The implementation of the two Lista compilers and the Pilum virtual machine is done with C++, Flex and Bison. The identifiers's language is French: it would have too much work to translate all that to English!

However, the language and the implementation's user interface are multilingual. French and English are supplied, and other languages can be added easily (see the Langue* source files).

NeverEnding.rb is a Ruby 1.8.x program roughly equivalent to the Lista sample above. It uses transitive closures, that generalize the traditional so-called thunk approach used to implement call by name/need.

More details on Lista and its current implementation can be found in 99BottlesOfBeer.README.

 

© 2010 CUI Uni-GE, webmaster@cui.unige.ch
Dernière mise à jour de cette page: vendredi 11 juin 2010 à 21:33
Dernière page du site mise à jour: Accueil.html, vendredi 11 juin 2010 à 21:33