Sunday, January 2, 2011

Milestone: Type Checking Works

I implemented type checking over the past days and today I was able to type check the frege/Prelude.fr successfully. These are about 2600 lines of Frege code with the most basic definitions - basic types, list operations, common classes and instances for various types - hence almost all language features are used here.

At the moment, the type checker ignores class constraints. The constraint handling will be very different from version 2, so I will perhaps need lots of tracing while implementing it. I want to avoid doing the tests on the Prelude itself  because the tons of trace output I would get then are not easily manageable.

Therefore, I must be able to compile small test programs that import the Prelude. To import something, I must first generate the meta data (which are custom Java annotations) and compile them to a class file.

Thus, the next milestone will be the GenMeta pass. This will be new territory also. In version 2 I exploited the fact that the javac of Java 5 had a bug that made it let pass recursive annotations, although they are forbidden.
It comes down basically to replacing all recursive fields in patterns, expressions and types with indices into appropriate arrays that hold the atomic elements.

No comments:

Post a Comment

Comments will be censored by me as I see fit, most likely if they contain insults or propaganda for ideologies I do not like. Comments that are on topic will not be censored. If I leave a comment uncensored this does not imply that I agree with the opinions expressed therein.