greg
065bdd6bda
Starting custom operators
...
Can now parse custom operators. Maybe I want to make it so that you
have to put explicit backticks if you define a custom operator,
currently you can just do: fn +() { .. }
2018-08-24 16:49:59 -07:00
greg
e125e8b440
Add spaceship operator for getting an ord
2018-08-24 16:29:28 -07:00
greg
8565c7dfb3
Some work on reduced ast pattern
2018-08-24 16:04:18 -07:00
greg
f885d5dfb6
Remove type alias
2018-08-22 23:22:08 -07:00
greg
b85725125c
Start using HalfExp
2018-08-22 16:41:31 -07:00
greg
2d961d6402
Fix other pattern parsing bugs
2018-08-21 20:02:10 -07:00
greg
fa7b6ce96b
Handle negatives in patterns correctly
2018-08-21 19:57:45 -07:00
greg
1d5e5aa735
Some type renaming in builtins
...
Builtins will remain entirely separate from the actual type
representation, whatever that ends up being
2018-08-19 22:00:20 -07:00
greg
2c298c7247
Add warning for undefined operator
...
In practice this will probably always not typecheck, but it's a valid
parse
2018-08-19 21:40:30 -07:00
greg
f00fee0e37
Rename StateStack -> ScopeStack
2018-08-19 21:31:45 -07:00
greg
0d13b5e3bc
Preliminary support for binops in if-discriminators
...
The BNF grammar is a bit more liberal than any successfully-compiled
schala program should be, in that it allows things like `if x < is
pattern`. It's okay if that parses successfully and then is an error at
typechecking.
2018-08-19 21:25:07 -07:00
greg
98f597f00a
Implement comparison operators correctly
2018-08-19 21:11:43 -07:00
greg
fb71881409
Refactor binop parsing
2018-08-19 20:33:50 -07:00
greg
d1c3b4a81b
Starting on halfexprs / binops
2018-08-19 18:44:54 -07:00
greg
f9181b5786
use expr_or_block where appropriate
2018-08-19 15:58:31 -07:00
greg
0e914cf057
Error message for parsing guards
2018-08-19 15:12:34 -07:00
greg
04ea8c5ebc
More unused code removal
2018-08-19 15:06:01 -07:00
greg
492ef4ae19
Clear up some unused code to reduce compile noise
...
And add some notes to the README
2018-08-19 15:03:41 -07:00
greg
75a7a4499d
Added some more cases to the match handling
2018-08-19 10:53:43 -07:00
greg
97bee58fbe
More work with guards
2018-08-15 22:34:04 -07:00
greg
34c2b43371
More work on if matching
2018-08-15 18:32:44 -07:00
greg
88b617de52
More atlernatives work
2018-08-15 11:44:55 -07:00
greg
482674b19a
Start on expr_or_block
...
WIP doesn't work yet
2018-08-15 09:34:00 -07:00
greg
a72b387ceb
Remove some more dead code warnings
2018-08-14 23:19:27 -07:00
greg
864e932e9f
Getting rid of more unused items
2018-08-14 23:09:11 -07:00
greg
d7e73be44c
Getting rid of some unused warnings
2018-08-14 23:07:00 -07:00
greg
0c0690e86e
Provide error message here
2018-08-14 21:53:57 -07:00
greg
6d18f80185
Use Result in test
2018-08-14 21:46:48 -07:00
greg
6825de3916
new_frame -> new_scope
2018-08-14 21:45:45 -07:00
greg
1b78fbff82
Tests for basic pattern matching
2018-08-14 21:39:33 -07:00
greg
897c1181a9
Basic pattern matching working
2018-08-14 21:17:43 -07:00
greg
6833bc4f00
Start on CaseMatch eval
2018-08-14 12:43:06 -07:00
greg
f2ded78776
ReducedAST: Match -> CaseMatch
...
makes it easier to grep for
2018-08-14 12:37:18 -07:00
greg
9debdd8d66
Primitive tuple
2018-08-14 02:03:05 -07:00
greg
8067c862f3
Switch out types for evaluator
2018-08-14 00:11:13 -07:00
greg
f9c2fc3f9d
Make code more concise
2018-08-07 17:09:53 -07:00
greg
5ead1e5d44
NewConstructor -> Constructor
2018-08-05 19:14:02 -07:00
greg
348a6f7c76
More work on pattern-matching
...
I think I need to entirely change the types in the evaluator.
ReducedAST should only care about NewConstructor (which I gotta rename),
and the evaluator is the only place that an implementation of a
primitive constructed type should live (see Peyton-Jones implementing a
functional langauge p. 70)
2018-08-05 19:11:42 -07:00
greg
5f336ec1a9
Add lookup_by_name to symbol table
2018-08-05 18:19:48 -07:00
greg
da59fae0d3
More work on pattern-matching
2018-08-05 18:01:42 -07:00
greg
5b5689accf
Changing representation of primitive objects
2018-08-05 17:15:58 -07:00
greg
32acf89814
New Constructor
2018-08-05 16:04:52 -07:00
greg
c637a922a9
Start implementing constructors/matches
...
as per Implementing Functional Programming Languages by Peyton-Jones
2018-08-05 14:23:08 -07:00
greg
42d0aba21c
Add index of variants to symbol table
...
Also new prelude type, just for testing
2018-08-05 13:59:13 -07:00
greg
bc6d4d19b5
reduced ast match
2018-07-26 00:52:46 -07:00
greg
a2b1b0f953
Pattern-matching in reduced AST
2018-07-26 00:52:46 -07:00
greg
75bf4b5697
Fill out variants to be reduced
2018-07-26 00:52:46 -07:00
greg
98e812968b
Fix parsing additional options
2018-07-26 00:52:46 -07:00
greg
250c486143
Fix derive code
2018-07-26 00:52:46 -07:00
greg
38eb065511
Broken proc macro custom derive code
2018-07-26 00:52:46 -07:00
greg
4ca57e4aea
Change name of debug options struct
2018-07-26 00:52:46 -07:00
greg
82502ad0ad
Move some parsing code around
2018-07-26 00:52:46 -07:00
greg
7d68b2a05a
Get rid of code related to old match stuff
2018-07-26 00:52:46 -07:00
greg
c2db212c78
Some more guard arm stuff + dealing with split binexp
...
... in if-blocks. Need to do some re-architecture I think
2018-07-26 00:52:46 -07:00
greg
837a180b09
Starting work on guard arms
2018-07-26 00:52:46 -07:00
greg
5ecd298e6a
Record Pattern
2018-07-26 00:52:46 -07:00
greg
8aa33d0872
Starting on guards
2018-07-26 00:52:46 -07:00
greg
21a8868bcf
Fixed test
2018-07-26 00:52:46 -07:00
greg
5a91957fa1
Some incomplete parse work
2018-07-26 00:52:46 -07:00
greg
176d43e56f
Remove old comment
2018-07-26 00:52:46 -07:00
greg
90ecde89c9
Mutable types
2018-07-26 00:52:46 -07:00
greg
65c2cd521b
Mutable types
...
This bit of syntax is meant for extendable enum types
2018-07-26 00:52:46 -07:00
greg
f7dbbddad1
Let and let mut syntax
2018-07-26 00:52:46 -07:00
greg
43ff08b04c
Add some debugging info around parse error
2018-07-26 00:52:46 -07:00
greg
00692aa89e
Support for underscores
2018-07-26 00:52:46 -07:00
greg
5e48eb2dee
Broken - some pass abstraction work
2018-07-26 00:52:46 -07:00
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