greg
3597ad4eef
Compact parsing
2018-07-26 00:52:46 -07:00
greg
072eab1a80
Thread debug opts around where they need to be
2018-07-26 00:52:46 -07:00
greg
55a8cabd7c
Some basic pattern stuff
2018-07-26 00:52:46 -07:00
greg
3c022fc4ef
Clarified BNF
2018-07-26 00:52:46 -07:00
greg
0a02c21e70
Some more Patterns work
...
-at first brush, a pattern is like a single Variant with a list of free
vars
2018-07-26 00:52:46 -07:00
greg
927f427a86
Starting work on patterns
2018-07-26 00:52:46 -07:00
greg
005aba7a10
Test alt form
2018-07-26 00:52:46 -07:00
greg
7882e92ab5
Fix old style if
2018-07-26 00:52:46 -07:00
greg
f582ab4eaa
Test for new style parsing
2018-07-26 00:52:46 -07:00
greg
f2dce38647
Broken, but compiling, move to new if paradigm
2018-07-26 00:52:46 -07:00
greg
ba4cd9da39
Kill match keyword + data structures
...
And add new unified keywords
2018-07-26 00:52:46 -07:00
greg
654eeef428
Clarified grammar BNF some
2018-07-26 00:52:46 -07:00
greg
a96fbc9592
Fix match expression parsing
2018-07-26 00:52:46 -07:00
greg
196954326e
Print bare data constructor
2018-07-26 00:52:46 -07:00
greg
3f2fff276c
Constructor eval
2018-07-26 00:52:46 -07:00
greg
ebcea685f3
Fix looking up functions
2018-07-26 00:52:46 -07:00
greg
3b9084810e
Add constructor reduced ast node; fix test
2018-07-26 00:52:46 -07:00
greg
7809cda240
Pass symbol_table to ast reduce
...
To distinguish between values and data constructors
2018-07-26 00:52:46 -07:00
greg
f1679e83b7
Start trying to fix tests
2018-07-26 00:52:46 -07:00
greg
f98d8e2bb0
Move AST into its own module
2018-07-26 00:52:46 -07:00
greg
d0a0cc8209
Rename ast_reducing -> reduced_ast
2018-07-26 00:52:46 -07:00
greg
5aa0e10e7a
Some ADT work
2018-07-26 00:52:46 -07:00
greg
27729cefdf
Some improvements to the thing
2018-07-26 00:52:46 -07:00
greg
df76e7c120
Pretty-print type table
2018-07-26 00:52:46 -07:00
greg
889610f0b0
Pretty-print Symbol Table
2018-07-26 00:52:46 -07:00
greg
3beabf4678
Start eval-ing data constructors
2018-07-26 00:52:46 -07:00
greg
25790f8643
Added super-janky prelude capability
2018-07-26 00:52:46 -07:00
greg
ff5446af3f
Add symbols from symbol table into global type context
2018-07-26 00:52:46 -07:00
greg
5d84153c9e
Want bin expressions typed soon
2018-07-26 00:52:46 -07:00
greg
0b0f6b6b50
Symbol table handles functions better
2018-07-26 00:52:46 -07:00
greg
856a360aba
Types need handle to symbol table
2018-07-26 00:52:46 -07:00
greg
81ca9ee20f
Add some data structures back
2018-07-26 00:52:46 -07:00
greg
4caf8096b3
Add Scheme, TypeEnv, Substitution data structs
2018-07-26 00:52:46 -07:00
greg
c65907388d
Some ADT work
2018-07-26 00:52:46 -07:00
greg
33c22c8bbc
Typecheck values
2018-07-26 00:52:46 -07:00
greg
4a27af2136
Add a super-basic test
2018-07-26 00:52:46 -07:00
greg
07af54b78a
More work
2018-07-26 00:52:46 -07:00
greg
c4666b82ec
Basics
2018-07-26 00:52:46 -07:00
greg
274dd1ccb0
Basic stuff
2018-07-26 00:52:46 -07:00
greg
70ec79c4b3
Lol starting over from scratch again
...
H-M is hard :/
2018-07-26 00:52:46 -07:00
greg
f88d2331e3
printf debugs for problems with function typing
2018-07-26 00:52:46 -07:00
greg
c8f961abbf
Functions
2018-07-26 00:52:46 -07:00
greg
d040d76bfa
Start handling function case
2018-07-26 00:52:46 -07:00
greg
887ba46b0b
Fix this thing
2018-07-26 00:52:46 -07:00
greg
a80db9e4c2
Debug types
...
WIP
2018-07-26 00:52:46 -07:00
greg
c986233a95
Adding bindings seems to work?
...
I'm playing real fast and loose though
2018-07-26 00:52:46 -07:00
greg
bb29df4a73
Variable binding insertion infrastructure
2018-07-26 00:52:46 -07:00
greg
4db3595d7c
More work on variables
2018-07-26 00:52:46 -07:00
greg
217ee73fc9
Literals
2018-07-26 00:52:46 -07:00
greg
93309c025e
Some work
2018-07-26 00:52:46 -07:00
greg
b67512a9e1
Add Infer struct
2018-07-26 00:52:46 -07:00
greg
8e6f605fab
Type alias "TypeName"
2018-07-26 00:52:46 -07:00
greg
ba4185b0fb
Back to including typechecking code in pipeline
2018-07-26 00:52:46 -07:00
greg
7a2a4df297
Clearing out most of the cruft from typechecking
2018-07-26 00:52:46 -07:00
greg
642e9da8ee
Move everything symbol-table-related into a separate module
2018-07-26 00:52:46 -07:00
greg
cea7427847
put TypeEnvironment on TypeContext
2018-07-26 00:52:46 -07:00
greg
3156c31dfc
Variable lookup
2018-07-26 00:52:46 -07:00
greg
2e457cd5e8
First real inferring
2018-07-26 00:52:46 -07:00
greg
843d895f2b
infer infra
2018-07-26 00:52:46 -07:00
greg
734c53ce0d
Starting to deal with actual expr inferring
2018-07-26 00:52:46 -07:00
greg
3a3b8dd440
TypeEnvironment lives in Infer
2018-07-26 00:52:46 -07:00
greg
c96a56a7ac
fresh
2018-07-26 00:52:46 -07:00
greg
4017857a3a
Unification
2018-07-26 00:52:46 -07:00
greg
9e0f8b8a14
InferError
2018-07-26 00:52:46 -07:00
greg
7121624f77
Type Env
2018-07-26 00:52:46 -07:00
greg
48e795decc
apply_substitution for PolyTypes
...
If I made an error it's likely here...
2018-07-26 00:52:46 -07:00
greg
a26da934f4
Substitution monotypes
2018-07-26 00:52:46 -07:00
greg
1de1cd9cfd
For H-M, add types and some impls
2018-07-26 00:52:46 -07:00
greg
6f639b9030
Type type structure
2018-07-26 00:52:46 -07:00
greg
8f0104ebc7
Deletion
2018-07-26 00:52:46 -07:00
greg
36cd7e080d
Even more deletions
2018-07-26 00:52:46 -07:00
greg
f48a25779c
Lol just get rid of all the old code, start from scratch again
2018-07-26 00:52:46 -07:00
greg
808a1bfc98
Still more deletions
2018-07-26 00:52:46 -07:00
greg
c7e46c1cfa
KIll any commented code
2018-07-26 00:52:46 -07:00
greg
98cfcfc18d
Eval shouldn't be aware of types
2018-07-26 00:52:46 -07:00
greg
b4c7ea3d02
Show bindings too in debug
2018-07-26 00:52:46 -07:00
greg
e7c89ed840
Some more refactoring
2018-07-26 00:52:46 -07:00
greg
b0e38f7f5b
Refactor
2018-07-26 00:52:46 -07:00
greg
276662d98a
Some code rearrangements
2018-07-26 00:52:46 -07:00
greg
e8e9265b26
Use less verbose match syntax
2018-07-26 00:52:46 -07:00
greg
cb316a973e
Getting back to hindley-milner
...
First, clear out some of this cruft in the compiler warnings
2018-07-26 00:52:46 -07:00
greg
e64861b602
Some eval tests
2018-07-26 00:52:46 -07:00
greg
1673fd1cf9
Fix test
2018-07-26 00:52:46 -07:00
greg
c00effcbdd
Add _
2018-07-26 00:52:46 -07:00
greg
8378170fbd
Kill comments
2018-07-26 00:52:46 -07:00
greg
7ab385d398
Bring custom ADTs to the repl
2018-07-26 00:52:46 -07:00
greg
9fb148bb02
Make compile again
2018-07-26 00:52:46 -07:00
greg
97df2fa344
I dunno
2018-07-26 00:52:46 -07:00
greg
a08134a747
Delete old code in eval
2018-07-26 00:52:46 -07:00
greg
3ac50f974d
Pass around reference to type context in evaluator
2018-07-26 00:52:46 -07:00
greg
afc4281e7f
Evaluate function arguments in context before applying them
2018-07-26 00:52:46 -07:00
greg
8d6fea942f
Handle function definition before use
...
And some other ReducedAST - Evaluation niceties
2018-07-26 00:52:46 -07:00
greg
6d93c758a2
Add function to symbol table
2018-07-26 00:52:46 -07:00
greg
aff421cd99
Working with symbol table
...
Note that symbol table is a different object now than the previous
binding table that was used for type-checking. That binding table is not
currently debugged and should be debugged in a separate debug output with
typechecking proper.
2018-07-26 00:52:46 -07:00
greg
493d76da0b
Add symbol table data structure to typechecking
2018-07-26 00:52:46 -07:00
greg
eb681fbff9
Make parse error message nicer
2018-07-26 00:52:46 -07:00
greg
f3e3843528
Decomplexify delimited!
2018-07-26 00:52:46 -07:00
greg
6b90e19eb1
Simplify expect! macro
...
Ends up printing a debug print, but whatever, will fix later
2018-07-26 00:52:46 -07:00
greg
210ae47c8b
Get rid of lambda
2018-07-26 00:52:46 -07:00
greg
70794d8ff1
For expression parsing
2018-07-26 00:52:46 -07:00
greg
532c8c45b4
Parse while expressions
...
Decided to add while expressions to the language to make for-parsing
easier. Plus some other random notes
2018-07-26 00:52:46 -07:00
greg
24b532df06
This doesn't need to be a closure
2018-07-26 00:52:46 -07:00
greg
ac576be604
Trim newline in getline()
...
Ineffiicent but whatever
2018-07-26 00:52:46 -07:00
greg
6bf106a1a3
Equality
2018-07-26 00:52:46 -07:00
greg
44e585fca2
Conditionals
2018-07-26 00:52:46 -07:00
greg
3f836eb74f
Kill some warnings
2018-07-26 00:52:46 -07:00
greg
abf25d648d
Change repl behavior of strings
2018-07-26 00:52:46 -07:00
greg
1f6e6d9b31
Tuples
2018-07-26 00:52:46 -07:00
greg
e2703121d8
Kill unneeded import
2018-07-26 00:52:46 -07:00
greg
e5b6b41422
Error msg
2018-07-26 00:52:46 -07:00
greg
6c5e3dea5d
Assignment
2018-07-26 00:52:46 -07:00
greg
bd8bf1945c
Super simple janky input
2018-07-26 00:52:46 -07:00
greg
9e393d2753
Kill old type structure
2018-07-26 00:52:46 -07:00
greg
822420a9d5
Add an eval test
2018-07-26 00:52:46 -07:00
greg
6f8dc9bedd
rename IntLiteral -> NatLiteral
2018-07-26 00:52:46 -07:00
greg
e0cec8b8a6
print, println as builtins
2018-07-26 00:52:46 -07:00
greg
1a84f62818
Kill some old code, make very_simple example print
2018-07-26 00:52:46 -07:00
greg
b1966d7199
Function calling works kind of
2018-07-26 00:52:46 -07:00
greg
fdbb21990d
Retrieve function from memory when called
2018-07-26 00:52:46 -07:00
greg
1011ff08f3
Use new rust 1.26 less verbose syntax
2018-07-26 00:52:46 -07:00
greg
6d8d2aecbd
Functions
2018-07-26 00:52:46 -07:00
greg
848306ad1a
Reduce defined function
2018-07-26 00:52:46 -07:00
greg
e6f0710e41
Debug ast rewrite
2018-07-26 00:52:46 -07:00
greg
78ba4e1ed3
Variable lookup
2018-07-26 00:52:46 -07:00
greg
481afb0f87
Fix debugging and debug eval
2018-07-26 00:52:46 -07:00
greg
01986e7474
starting bindings
2018-07-26 00:52:46 -07:00
greg
9cf5260d4b
Use impl Trait to simplify type signatures
2018-07-26 00:52:46 -07:00
greg
18c8176134
Get rid of unneeded imports
2018-07-26 00:52:46 -07:00
greg
2cb7d35008
Use EvalResult type
2018-07-26 00:52:46 -07:00
greg
bd1eed884f
State type manipulations
2018-07-26 00:52:46 -07:00
greg
67917612e6
Swap over eval code to new paradigm
...
While keeping the old code commented for reference
2018-07-26 00:52:46 -07:00
greg
b4a16cdc55
Prefix ops
2018-07-26 00:52:46 -07:00
greg
4d5ab95946
Fix bug with / parsing
2018-07-26 00:52:46 -07:00
greg
ce71254b69
Implement a lot more ops
2018-07-26 00:52:46 -07:00
greg
065e58f87e
Successfully interpreting addition
2018-07-26 00:52:46 -07:00
greg
6768cebc48
Literals
2018-07-26 00:52:46 -07:00
greg
ec5580d20b
prefix op reduction
2018-07-26 00:52:46 -07:00
greg
9de66a9af3
Unimplemented sigil
2018-07-26 00:52:46 -07:00
greg
633b4fe7a4
Nats, some binop reduction
2018-07-26 00:52:46 -07:00
greg
87c3b8e234
Some work
2018-07-26 00:52:46 -07:00
greg
16a463b1a0
Method-style
2018-07-26 00:52:46 -07:00
greg
c3be644133
Optional scope name
2018-07-26 00:52:46 -07:00
greg
e7615fda8b
Add new_frame method
2018-07-26 00:52:46 -07:00
greg
111657b567
Add generic stack data structure
...
I'll want to use this soon enough
2018-07-26 00:52:46 -07:00
greg
c5e8d3e080
Random notes re: symbol table
...
I'm proably gonna want to redo the symbol table stuff after reading Language
Implementation Patterns, esp. to accomodate scopes
2018-07-26 00:52:46 -07:00
greg
4f49c183b0
Float + reduce binop/prefixop
2018-07-26 00:52:46 -07:00
greg
81368179bb
More boilerplate
2018-07-26 00:52:46 -07:00
greg
30128d7d34
Easy work
2018-07-26 00:52:46 -07:00
greg
6c718e5d4f
Start AST-reducing
2018-07-26 00:52:46 -07:00
greg
774ddd665b
Infrastructure to evaluate reduced AST
2018-07-26 00:52:46 -07:00