Powered by SourceForge   Home | About | Partners | Contact Us

Refactoring the XLR compiler

I am currently working on a rather serious refactoring of the XLR compiler. The objectives are the following:

  • Fix a number of issues with scoping and closures
  • Pave the way for assignments and mutable XLR trees
  • Activate the type system and related optimizations

A number of changes happen in the compiler structure as a result:

  • The Context class is gone
  • Error management (Error and Errors classes) were deeply redefined. Ooops is now in errors.h where it belonged.

This is now well under way. About 50% of the tests pass again.

I ran into an interesting issue with the type of the factorial. In XLR, the factorial is defined as follows:

0! -> 1
N! -> N * (N-1)!

The problem is how we deduce the type of N! from this code. Deducing the type of 0! is easy enough. But for the type of N!, we have to figure out the type of M! where M is of as-yet-unknown type. So do we need support for some kind of general-purpose type equations? That seems to be how OCaml or Haskell address this.