The files in source/compiler implements the compiler.
 
Utilities
**********

symbol.ml{mli}
==============
  Implements a simple module mapping strings to unique identifiers (symbols).

table.ml{mli}
============
  Defines a "template" for symbol tables (binary search tree). 

errormsg.ml{mli}
===============
  Defines functions for handling error in compilation and for debugging.

option.ml{mli}
=============
  Defines operations on option type with the system's own error handling.


Parse into pre abstract syntax
******************************

lplex.mll
=========
  Implements the scanner.

lpyacc.mly
==========
  Implements the parser (to pre abstract syntax).

preabsyn.ml{mli}
================
  Defines the pre abstract syntax and their operations.

compile.ml{mli}
===============
  Implements the top-level control of parsing a program (query/term) into
  pre abstract syntax.
  (Really should give it a more precise name.)


Parse into abstract syntax 
***************************

absyn.ml{mli}
=============
  Defines the abstract syntax and their operations.

translate.ml{mli}
=================
  Defines functions for translating a pre abstract syntax module into an
  abstract syntax module: processing kind and constant declarations and 
  generating compiler symbol tables and constant/kind lists; top-level 
  control of translating a preabstract syntax term into abstract syntax.

parse.ml{mli}
============
  Defines functions for translating a pre abstract syntax clause into
  an abstract syntax term and translating a pre abstract syntax term 
  (query/predicate term) into abstract syntax.


types.ml{mli}
=============
  Implements type inference and operations on abstract syntax representation
  of types needed for other modules.

 
Clause processing
*****************

clauses.ml{mli}
===============
  Implements deorification and clause-normalization.

typereduction.ml{mli}
=====================
  Implements type skeleton analysis and predicate type neededness 
  analysis.

processclauses.ml{mli}
======================
  Implements the transformation from (absyn) term representation to 
  clause representations (without variable analysis). 
   1. Type environments associated with constants occurrences are trimmed 
      according to the type skeleton optimization.                           
   2. Lambda-bound variables are transformed into de Bruijn indexes and the    
      list of binders in an abstraction term is removed.                       
   3. Other variables (type variables) are transformed into logic (type)       
      variables with a form suitable for variable annotations; their scope     
      information are collected and recorded along with clauses and goals.     
   4. Clauses defining a predicate are collected and associated with the       
      predicate name being defined.                                            
   5. String arguments are collected.                                          

annvariables.ml{mli}
====================
   Process clause representations in a module, annotate type and term       
   variables as temporary or permanent, and decide offset for permanent     
   variables. Fill in variable related information for clause               
   representations: hasenv, cutvar and goal-environment size association.   


Code generation
****************

codegen.ml{mli}
===============
   Defines functions and structures for preparing all information gathered 
   from a module for dumping out into a bytecode file.

clausegen.ml{mli}
================
   Implements code generation for each clause.

registers.ml{mli}
=================
   Defines structures and functions for register allocation.

instr.ml{mli}
============
   Defines instruction format. (Needed by the compiler and the disassembler.)
   Note these files are automatically generated.


Dump bytecode file
******************

spitcode.ml{mli}
================
   Defines functions for putting out all the information 
   generated by the procedures in codegen after a successful processing    
   of a module into in the required bytecode form into a specified bytecode 
   file.                                                                   

bytecode.ml{mli}
===============
   Defines functions and structures for write and read bytecode files 
   according to bytecode file format.
   (Please refer to implnotes/bytecode.txt for the details of bytecode format.)


Pervasives
**********

pervasive.ml{mli}
=================
   Defines the pervasive symbol tables. 
   Note these files are automatically generated.

pervasiveutil.ml{mli}
=====================
   Defines some operations on pervasives which are not needed to be
   automatically generated.