etcinitd/jalf — pull request #3 by blambeau (2014-09-19 08:02:26+00:00)
Title: Implement JAlf's Type System

@etcinitd Here is a first implementation of the type system. Before merging, we should still do the following:

- [ ] Create a lot of unit tests
- [ ] Complete documentation
- [ ] Implement proper type checking of `relation(...)` literal by checking/imposing their type to Tuple.
- [ ] Refactor `Relation#equals` to return false unless relations have same type.

In addition, there are a few design choices that are arguable. Among those:

- [ ] Type inference is lazy on operators, instead of being immediately computed/passed at construction time. Passing the type at construction time is at least required to avoid recomputing the types everytime in AST rewriting.
- [ ] Tuple supports not knowing it's type at all, and infers it when asked. This is mostly to avoid computing the tuple type in DSL's `tuple()` while the main scenario is embedding the tuple in a `relation(...)` call that would know its own type. It is then able to check/impose it to the tuples. Now, maybe that's premature optimization; relation literals are not that big in practice.