Commit Graph

17 Commits

Author SHA1 Message Date
Edwin Brady
cd958bd304 Remove 'Case' from Term structure
It seems that this isn't going to buy us enough to be worth the
complications of compiling case trees, dealing with 'with' etc.
2019-04-19 20:10:55 +01:00
Edwin Brady
c41ab9778f Progress towards pattern matching
Checking IBindVar and IBindHere, and first check of left hand side with
implicitly bound pattern variables.
2019-04-18 14:51:04 +01:00
Edwin Brady
e2594e9c80 Make a start on TTC reading/writing 2019-04-07 21:12:04 +01:00
Edwin Brady
56c0ec5324 Implement inferLambda
This checks lambdas where the type isn't immediately a pi binder. First
normalises, if that doesn't work, just guesses and unifies with the
expected type.
2019-04-07 17:16:44 +01:00
Edwin Brady
b8595eef8b Fill in some holes
The 'case' case of mkLocals, and looking up types of primitive constants
2019-04-07 14:51:50 +01:00
Edwin Brady
968b48c96e Some optimisations
Hole list represented as a map now for quicker deletion of solved holes.
Unification returns whether it solved any holes as part of its result,
so we know if it's worth going back to solve constraints if progress has
been made.
2019-04-07 11:50:36 +01:00
Edwin Brady
3cd09bb6a8 Unification infrastructure all done
Can instantiate metavariables, although there's a lot of cases still to
deal with
2019-04-06 13:53:59 +01:00
Edwin Brady
6174acc52a Progress on elaborator
Changed 'check' so that it returns the type as a 'Glued', which is a
pair of a term and its normalised form (or, more accurately, the process
to generate each in Core). Sometimes the elaborator needs Term,
sometimes in needs NF; this way we can return both but only actually
generate it when its needed.

So far, mostly done applications, binders and variables. Unification is
still to do.
2019-03-23 18:13:49 +04:00
Edwin Brady
547eea953c A bit of reorganisation
Better to have the elaborator across multiple files, for ease of
navigation. Also abandon the idea of local unification variables -
we'll keep them global, and try let binding them on leaving a scope.
2019-03-18 16:25:53 +00:00
Edwin Brady
7d672407c8 Start on UnifyState
Also removed 'MV' as a special name type, and added a Meta constructor
in TT which is applied to exactly the right number of arguments for the
environment the meta was constructed in.

It's possible the local unification UCtxt may be more trouble than it's
worth! Instead perhaps we can try let binding unification solutions where
possible on leaving the scope in which they're introduced.
2019-03-17 20:43:51 +00:00
Edwin Brady
57f1fb77c3 Added 'quick' unify
Unification based only on constructor arguments and matching - anything
else fails. Idea is to solve 'easy' local unification problems quickly,
without having to create a global metavar applied to the current context.
2019-03-17 13:34:22 +00:00
Edwin Brady
23051a55de Add Weaken interface, to start evaluator 2019-03-10 22:00:10 +00:00
Edwin Brady
0f8d337b27 Add a main program which processes a source file 2019-03-10 18:20:26 +00:00
Edwin Brady
992d8dd0f9 Added parser for most basic terms
Just variables, binders, applications, and basic declarations (data,
type and function definitions)
2019-03-10 17:56:08 +00:00
Edwin Brady
e03a2ba4b5 Added context for global names, store in an array 2019-03-10 15:14:38 +00:00
Edwin Brady
77e634cd33 Add specialised maps for Int and Name
The repetition is unfortunate, but worth it for avoiding the overhead of
passing an Ord dictionary around
2019-03-07 23:29:03 +00:00
Edwin Brady
082bc5cd54 Initial structure
TT types and values, some text manipulation, basics of Core
2019-03-07 23:04:55 +00:00