Commit Graph

509 Commits

Author SHA1 Message Date
greg
33c2786ea1 More complicated FormalParam type 2019-06-16 14:56:52 -07:00
greg
bc01a5ded8 Make reduced ast call handler be a separate method 2019-06-16 00:21:39 -07:00
greg
71386be80e Make tests pass by using multiple-k lookahead 2019-06-14 02:28:14 -07:00
greg
ccdc02bbd0 Peek multiple tokens ahead 2019-06-14 01:30:53 -07:00
greg
3a207cf7a7 Make TokenHandler use an array and index
Instead of a peekable iterator, so I can implement LL(k) parsing
2019-06-14 00:44:54 -07:00
greg
66f71606ef Add back some debugging for parsing 2019-06-14 00:23:47 -07:00
greg
53ce31ea8c Start creating new TokenHandler infra
on top of old stuff
2019-06-14 07:21:32 +00:00
greg
4c688ce8b2 Lol grammar is no longer LL(1)
need to fix
2019-06-13 02:27:11 -07:00
greg
40579d80ce More work on args
not quite done
2019-06-12 03:28:46 -07:00
greg
fa1257e2cd Starting work on more complicated call expressions
Probably won't build yet
2019-06-12 00:20:20 +00:00
greg
e9fd20bfe5 A few more fixes to EBNF 2019-06-09 01:12:19 -07:00
greg
dfbd951aaf Some fixes to the EBNF grammar 2019-06-09 01:08:32 -07:00
greg
6b47ecf2d7 First pass at putting EBNF grammar into rustdoc 2019-06-09 00:01:11 -07:00
greg
78d1e93e4b Put back rudimentary debug output 2019-05-28 03:41:49 -07:00
greg
856c0f95ce Wrap schala pass inputs in token struct 2019-05-28 03:07:35 -07:00
greg
3fa624bef4 Paramaterize debugging steps 2019-05-27 15:06:50 -07:00
greg
548a7b5f36 DebugRequests should be set 2019-05-26 04:16:40 -07:00
greg
fe7ba339b5 Per-stage timing output 2019-05-25 20:09:11 -07:00
greg
6a232907c5 Kill useless DebugRequest type 2019-05-25 19:31:41 -07:00
greg
eb2adb5b79 Moving options around
Showing time
2019-05-21 02:46:07 -07:00
greg
2b407a4a83 Total duration Timing 2019-05-21 02:06:34 -07:00
greg
6da6f6312d Remove more unused code 2019-05-20 22:04:14 -07:00
greg
ce2a65b044 Clean up some unused code 2019-05-20 16:10:50 -07:00
greg
4ebf7fe879 Remove more unused variables 2019-05-14 11:15:12 -07:00
greg
efbeff916a Allow this unused macro
for tests only
2019-05-14 10:51:32 -07:00
greg
2b8e2749a4 Get rid of unneeded mut's 2019-04-29 23:57:38 -07:00
greg
6c369b072f Debug immediate working for symbol table 2019-03-31 01:13:40 -07:00
greg
938c0401d1 Some various work 2019-03-27 02:20:43 -07:00
greg
3a98096b61 Add back debug passes command completion support 2019-03-19 19:37:29 -07:00
greg
9476e7039b Doc requests in type system 2019-03-19 19:26:05 -07:00
greg
c767402865 Remove some no-longer-necessary indirection 2019-03-19 19:16:41 -07:00
greg
61972410ea Functionality to request/respond to meta items 2019-03-19 19:12:32 -07:00
greg
d3f9430a18 Avoid unnecessary String 2019-03-19 19:01:04 -07:00
greg
14c08bbcdb Get rid of EvalOptions
and associated types
2019-03-19 18:40:21 -07:00
greg
1622a6ce44 Grand culling
Deleting a bunch of old code related to the old way the interpreter
worked
2019-03-14 00:51:33 -07:00
greg
7e899246e9 More refactoring in main Schala driver 2019-03-14 00:15:13 -07:00
greg
8610bd7a87 Port Schala to new framework
Evaluating a Schala function in the REPL works again with no debug info
2019-03-13 22:43:44 -07:00
greg
42aa316a23 Fix custom attribute thing
Upon updating rust version, the unrestricted_attribute_token thing
broke, but I'm changing this anyway so whatever
2019-03-12 01:05:10 -07:00
greg
2bf777f37b Add this note to self 2019-03-11 19:36:10 -07:00
greg
bdcae36b60 More cleaning up of how scopes are stored
on Symbol
2019-03-11 02:47:47 -07:00
greg
dbcd2278a6 Renamings 2019-03-11 02:35:42 -07:00
greg
2490aaf3f4 Add types necessary for refactor of Symbol table 2019-03-11 01:36:11 -07:00
greg
d4ad97b39a start preparing to get rid of symbol_table.lookup_by_name 2019-03-10 17:32:47 -07:00
greg
24213070a3 Delete useless comment 2019-03-10 17:29:02 -07:00
greg
051669b4cc Stuff pertaining to variant scoping 2019-03-10 17:24:58 -07:00
greg
c64f53a050 Detect duplicate variable declarations correctly
Later I'll probably want to make it so that you can explicitly override
the value of a declared variable
2019-03-10 17:02:01 -07:00
greg
8f176543c7 Nested scopes in symbol table 2019-03-10 16:04:20 -07:00
greg
9716b5e55b Symbol table detects some duplicate symbols 2019-03-08 03:57:32 -08:00
greg
956353cd80 Move rc! macro to util
So it can be used anywhere
2019-03-08 01:15:19 -08:00
greg
98db60498a Add very basic symbol table test shim 2019-03-07 23:51:31 -08:00
greg
7694afc9e2 Add type for talking about symbol paths
to symbol table
2019-03-07 20:45:12 -08:00
greg
0bcd7e6f41 Add new_env method
This is basically the same as the one on the evaluator and makes use of
the ScopeStack - maybe need to generalize this more?
2019-02-27 02:15:19 -08:00
greg
d515b1658a Some fixes 2019-02-24 16:24:45 -08:00
greg
e501f4bd10 Various cleanup of comments, stringifying types 2019-02-23 09:59:41 -08:00
greg
5bac01cf20 More boilerplate for apply 2019-02-23 03:55:46 -08:00
greg
0e9b3229e9 Refactor Arrow; add general handle_apply 2019-02-23 03:33:56 -08:00
greg
b709cfd51a Start adding call 2019-02-23 02:50:11 -08:00
greg
e34295a6f7 Starting on lambda typechecking 2019-02-23 02:45:11 -08:00
greg
8dc34e4b49 Fresh type var 2019-02-23 01:27:32 -08:00
greg
2cc3367666 Unify var-var 2019-02-23 01:20:19 -08:00
greg
452f2ab188 Unify var-const 2019-02-23 01:18:15 -08:00
greg
be175a2b75 Add more infrastructure for unify 2019-02-23 00:59:58 -08:00
greg
00a0de4431 Add ena crate for unification 2019-02-23 00:34:44 -08:00
greg
f041cc17d2 Wrap all Expression nodes in Meta<Expression> 2019-02-21 23:35:18 -08:00
greg
95fe1941a1 Kill some unused items 2019-02-21 18:39:41 -08:00
greg
b35262c444 Rename Node -> Meta 2019-02-21 01:49:15 -08:00
greg
9bb3a2be88 Add type data handle on Node
I think the way I want to handle this is a two-step process: first infer and
fill in variables, then unfiy in a separate step. Storing the data in
the AST is handy.
2019-02-21 01:46:27 -08:00
greg
9fa0576547 Rename ExpressionType -> ExpressionKind 2019-02-21 01:26:51 -08:00
greg
6fba0cc5b4 Add variables 2019-02-21 01:17:34 -08:00
greg
a6eb2b4020 Allow type annotations in let expressions 2019-02-20 22:44:45 -08:00
greg
03793e08d3 Typechecking operators 2019-02-20 03:27:46 -08:00
greg
2be55958f4 add Into<String> arg for error constructors 2019-02-20 02:06:58 -08:00
greg
bcf48d0ecb First tests for typechecking 2019-02-20 01:33:45 -08:00
greg
f0ed63ccf3 Basic if-statement checking 2019-02-19 23:00:41 -08:00
greg
6012bd1087 Variables 2019-02-19 21:41:07 -08:00
greg
df7e74c79d Types with arguments 2019-02-17 04:31:02 -08:00
greg
abbd02eaef Use ty! macro 2019-02-17 04:25:38 -08:00
greg
993741e67f Get rid of typecheck_ 2019-02-17 04:08:49 -08:00
greg
fbb7b995b8 Rename mk_type! to ty!
Doesn't seem to conflict with the same macro in the parser tests, so should be
ok
2019-02-17 03:38:15 -08:00
greg
9d4f086a04 Put mk_type! in typechecking module 2019-02-17 03:36:12 -08:00
greg
e38ae1c3f1 Fix type to make it compile 2019-02-15 21:11:50 -08:00
greg
d969d573fa Starting work on values 2019-02-12 21:14:13 -08:00
greg
35da1748f0 Some more type work 2019-02-10 12:21:12 -08:00
greg
5e1799268d Unification works with bad annotations 2019-02-10 07:32:12 -08:00
greg
42a801d346 Rename Order -> Ordering 2019-02-10 07:06:30 -08:00
greg
a80e1bd706 Type name infra 2019-02-10 07:05:01 -08:00
greg
afd9aa52c5 More infra around unify 2019-02-10 06:53:11 -08:00
greg
5a70784346 Adding unify stub 2019-02-10 06:48:25 -08:00
greg
0dff177e8f Add more literals kill errors 2019-02-10 05:33:55 -08:00
greg
cf91f74912 Pass through type info to repl 2019-02-10 05:31:58 -08:00
greg
06e9452718 More type infrastructure
From here on out, I can start playing with concrete code that attempts
to actually typecheck limited syntactic constructs, and see what I end
up with.
2019-02-10 05:24:11 -08:00
greg
7d3ae36058 AST-walking infrastructure 2019-02-10 04:42:30 -08:00
greg
e8f1f51639 Move (most of) the type definitions back to typechecking module
Still need to figure out the macro export thing
2019-02-10 04:30:37 -08:00
greg
170cf349d7 Starting typechecking work again 2019-02-09 00:25:12 -08:00
greg
c0111e30bc SymbolTable: Add Record type 2019-01-25 00:57:01 -08:00
greg
c225e469ee Change Record variant representation 2019-01-24 20:47:20 -08:00
greg
1ce06bc0ef More symbol-table refactoring 2019-01-20 22:32:58 -08:00
greg
10c3a60515 Some symbol-table refactoring 2019-01-20 00:23:08 -08:00
greg
a63dcf91b0 Replace // with quot 2019-01-10 20:57:13 -08:00
greg
479a098e0f Make note to fix parsing bug 2019-01-09 17:37:51 -08:00
greg
1085b528fe Don't care about case-sensitivity 2019-01-08 02:38:10 -08:00
greg
9b3b5c5541 Token offsets 2019-01-08 02:11:19 -08:00
greg
ab8e24a276 ParseError always has token now 2019-01-08 01:04:46 -08:00
greg
09e2d8579d Remove all ParseErrors that don't return the failed token 2019-01-08 01:00:40 -08:00
greg
ee7861cbd0 Fix how impl blocks work
This gets rid of a token-less parseerror
2019-01-08 00:51:56 -08:00
greg
b88def8a2e Make error msg better 2019-01-07 16:52:46 -08:00
greg
30676722a3 Transition to edition 2018 2019-01-07 13:00:37 -08:00
greg
801c90aaa7 Reorder parameters in pass functions 2019-01-07 02:43:31 -08:00
greg
fa295aab28 Show location of error in parse error 2019-01-07 01:52:54 -08:00
greg
a0f4abb9a3 Add SourceReference 2019-01-06 01:58:16 -08:00
greg
5491169d55 Refactor parsing structure
TokenHandler should contain all the methods for actually manipulating
tokens, Parser should only contain the recursive descent methods
2019-01-05 20:23:07 -08:00
greg
2b338fd3c9 Move .next() onto token_handler 2019-01-05 18:29:24 -08:00
greg
821f321261 More Node-wrapping of Expression 2019-01-05 18:11:51 -08:00
greg
846eeae04c More use of Token instead of TokenKind 2019-01-05 17:50:54 -08:00
greg
22f2750853 More use of Token in error messages 2019-01-05 17:40:05 -08:00
greg
f2f8ac7ee8 Make parserrors have token 2019-01-05 17:32:49 -08:00
greg
d0c5dce92b Use get_kind() 2019-01-05 17:28:35 -08:00
greg
8eda74c9a5 Starting to keep track of locations of errors in file 2019-01-05 17:18:10 -08:00
greg
2efac109ef Node for TupleLiteral 2019-01-05 16:06:55 -08:00
greg
215e2bbb0d PrefixOp have Node 2019-01-05 16:02:30 -08:00
greg
2590def3be More Node-wrapping 2019-01-05 15:54:03 -08:00
greg
879a7de83d Wrap Expression in Node 2019-01-05 15:47:44 -08:00
greg
4c2e0b8a21 Get rid of old code from old ideas 2019-01-05 15:35:51 -08:00
greg
282c42da3c Adding Node intermediate type to AST 2019-01-05 01:44:32 -08:00
greg
7ac97ca6e8 Kill ast_visitor 2018-11-26 01:57:44 -08:00
greg
26a8ff307f Add generic Node type 2018-11-20 03:21:10 -08:00
greg
e00948cad9 Add ast_visitor mod 2018-11-17 02:09:16 -08:00
greg
0af6fed505 Clear up some code a bit 2018-11-17 01:10:23 -08:00
greg
1f527f7949 Rename TokenType -> TokenKind 2018-11-16 23:17:34 -08:00
greg
b198984fc5 implement From for Expression-types 2018-11-16 14:06:04 -08:00
greg
58779f8470 Rename method, make sourcemap optional 2018-11-16 12:58:10 -08:00
greg
a0fa50392c Fix compile error 2018-11-16 12:46:29 -08:00
greg
d357876b16 WIP source map stuff 2018-11-16 04:12:07 -08:00
greg
e42f0c644c Introduce source map 2018-11-16 03:56:55 -08:00
greg
2ec7bf3b9a Some initial work on passing token metadata to AST 2018-11-16 03:51:03 -08:00
greg
5147e1a3eb Handle underscores in identifiers 2018-11-15 16:19:53 -08:00
greg
955c073174 Got typechecker unused errors down to one 2018-11-13 02:39:02 -08:00
greg
7c46a29141 Start adding doc comments 2018-11-11 18:04:44 -08:00
greg
0adc761e72 Kill an unimplemented!() 2018-11-11 02:48:51 -08:00
greg
b2039a7b67 Parameterize Type type over existential/universal 2018-11-10 16:33:42 -08:00
greg
b4c4531e4d Rename for more concision 2018-11-10 14:11:29 -08:00
greg
2d36ad44d6 Converting over types
WIP
2018-11-09 02:50:29 -08:00
greg
21132a369c Paramaterize Type 2018-11-09 02:05:59 -08:00
greg
ff0294c56e Typechecking shouldn't fail yet 2018-11-09 02:02:08 -08:00
greg
e39356c0e5 Even more type work 2018-11-09 00:21:34 -08:00
greg
d44bb02d61 Even more types 2018-11-08 20:30:17 -08:00
greg
9056e9b0e1 More type work2 2018-11-08 02:29:54 -08:00
greg
e9b90412ce More type work 2018-11-08 02:12:01 -08:00
greg
65c47c20fc Change name of monad in which type inference happens 2018-11-07 17:01:07 -08:00
greg
fab3fb8ec2 More basic types + test 2018-11-07 16:39:32 -08:00
greg
0d5ccd21fe TConst 2018-11-07 15:39:40 -08:00
greg
69b7b9f528 Print out types to REPL 2018-11-07 13:44:28 -08:00
greg
9a09f40222 More typing work 2018-11-07 03:39:31 -08:00
greg
020819550b More typechecking infrastructure 2018-11-06 16:47:34 -08:00
greg
15f9dbe7a6 Typechecking infrastructure 2018-11-06 13:44:52 -08:00
greg
836bed1207 Added janky map to prelude 2018-11-06 03:02:32 -08:00
greg
cee5b085d5 Simpler syntax for single param in lambdas
This kind of implies that I might want -> for function types after all,
instead of :
2018-11-06 02:58:57 -08:00
greg
837a55c718 Test for nested function call 2018-11-06 02:42:28 -08:00
greg
f4f89b39b6 Handle nested function calls 2018-11-06 02:40:10 -08:00
greg
c6b4ed7ee4 Basic lambdas 2018-11-06 01:19:16 -08:00
greg
be425860af Starting on lambdas 2018-11-05 21:13:31 -08:00
greg
17e88b33f2 Eval test doesn't need to be a macro
Can be a fn
2018-11-05 21:07:06 -08:00
greg
47f7eb1ef6 Make prelude be separate file 2018-11-05 20:55:03 -08:00
greg
72d0cfe466 More macro test consolidation 2018-11-05 20:52:18 -08:00
greg
cea2f63b44 Use macros to make types more concise 2018-11-05 20:12:10 -08:00
greg
eec315dd58 Get rid of exprstatement! macro
For shorter exst! one
2018-11-05 19:58:55 -08:00
greg
1e9aa91c5d More concise test macros 2018-11-05 19:57:11 -08:00
greg
9813609ad7 Minor test refactoring 2018-11-05 19:17:53 -08:00
greg
5953d9d815 type annotations on lambdas 2018-11-05 19:10:34 -08:00
greg
a74e09c761 Change lambda syntax 2018-11-05 18:51:01 -08:00
greg
ad53d4394b Get rid of println 2018-11-05 14:52:51 -08:00
greg
151246e1c5 Test for pattern-matching 2018-11-05 14:11:49 -08:00
greg
77d2826918 Pattern-match on structured objects 2018-11-05 14:01:14 -08:00
greg
1bd48ed5db Fix problem with parsing commas
I should probably rethink how delimited block expressions like if-blocks
(and eventually for-blocks) work
2018-11-05 13:07:08 -08:00
greg
c394b81746 More pattern-matching 2018-11-05 04:02:04 -08:00
greg
ec29077247 More tuple-matching
Also discovered parser bug
2018-11-05 03:41:03 -08:00
greg
62043ac2d1 Starting on pattern-matching tuples
Lots of duplicated code here
2018-11-05 03:17:03 -08:00
greg
bada386979 More work on subpattern matching 2018-11-03 12:53:09 -07:00
greg
e71d404071 Finished this refactor 2018-11-02 19:54:04 -07:00
greg
cab4702bd6 Refactoring matching - WIP
doesn't work yet
2018-11-01 02:43:47 -07:00
greg
ec5a9d457e String patterns 2018-10-31 01:45:16 -07:00
greg
bfbc1580aa Make tag optional 2018-10-30 23:36:55 -07:00
greg
2d6c9010b9 More work here 2018-10-30 18:53:34 -07:00
greg
f4ff92302f Use subpattern abstraction 2018-10-30 18:46:06 -07:00
greg
e88ed97b06 Add subpattern struct 2018-10-30 18:39:25 -07:00
greg
b8df09e956 Change eval strategy to use conditional sigil 2018-10-29 01:50:43 -07:00
greg
d7f0147a4f Add conditional target placeholder expr 2018-10-28 12:45:45 -07:00
greg
f883512882 New abstraction layer in Schala-lang parser
Just for manipulating tokens
2018-10-21 16:33:21 -07:00
greg
37070a6b3e Move pass chain generation from macro to codegen 2018-10-20 18:00:05 -07:00
greg
d7baf065fb Changing what method to call to start parsing 2018-10-20 15:41:09 -07:00
greg
6b42f8b8de Change how parsing works 2018-10-20 14:27:00 -07:00
greg
7de536ade0 Install failure crate 2018-10-20 11:17:18 -07:00
greg
4679a9fc7f Remove compiler warnings 2018-10-20 00:55:37 -07:00
greg
c25354b2c7 Get rid of typechecking code (for now)
I'm tired of seeing the errors. See branch last_commit_with_typechecking
2018-10-20 00:41:56 -07:00
greg
5f8b842bf2 Delete newline 2018-10-20 00:22:41 -07:00
greg
fef66e345b Subpattern field 2018-10-19 17:43:22 -07:00
greg
e57d33eae7 More work on more patterns
-need to convert guard into a possibly-empty vec
2018-10-19 17:27:06 -07:00
greg
dca9ad06c3 Handle HalfExpr closer to correct 2018-10-19 11:02:10 -07:00
greg
354148c5ba rename codegen -> chala-lang-codegen 2018-10-19 09:57:35 -07:00
greg
6219a06d6f Converted all parser methods to use the annotation 2018-10-19 02:56:11 -07:00
greg
4ecf63c54d Okay the proc_macro is actually doing something
At the cost of breaking code
2018-10-19 02:36:23 -07:00
greg
3d00667caf Add test for ignored pattern 2018-10-18 15:55:24 -07:00
greg
4b9c7e38dd Rename TypeName -> TypeIdentifier 2018-10-18 13:27:09 -07:00
greg
dff204069f Starting to implement Ignored pattern 2018-10-18 01:54:36 -07:00
greg
f2282f0101 case_match_expression split out into its own method 2018-10-18 01:49:42 -07:00
greg
40ccea8c05 Separate assign_expression method 2018-10-18 01:46:30 -07:00
greg
cae6f2f768 Rename schala-codegen -> schala-repl-codegen 2018-10-18 01:09:29 -07:00
greg
1be6991f55 Making eval expression method a bit less complex
by splitting it into submethods
2018-10-17 20:46:16 -07:00
greg
3b20b9e209 Put schala-lang crates into a subdirectory 2018-10-17 14:51:48 -07:00