Commit Graph

362 Commits

Author SHA1 Message Date
Greg Shuflin
7c3e924194 WIP last tests 2021-11-20 00:03:05 -08:00
Greg Shuflin
a41d808da3 More work 2021-11-19 23:04:00 -08:00
Greg Shuflin
eeec85c2b1 Fix other error 2021-11-19 20:43:37 -08:00
Greg Shuflin
ec5bf12a65 Fix test for reserved words error 2021-11-19 18:27:58 -08:00
Greg Shuflin
bb26d9e674 Force program() to consume all input 2021-11-19 10:00:16 -08:00
Greg Shuflin
219f5a183a Various cleanup 2021-11-19 09:59:08 -08:00
Greg Shuflin
69d857e94d Imports 2021-11-19 01:35:25 -08:00
Greg Shuflin
8365690860 Fixes 2021-11-19 01:08:07 -08:00
Greg Shuflin
7ae7eaa07b Flow 2021-11-19 01:01:26 -08:00
Greg Shuflin
88d2571401 Lambdas 2021-11-19 00:52:00 -08:00
Greg Shuflin
721a499384 if exprs 2021-11-19 00:40:10 -08:00
Greg Shuflin
ec51659452 Make identifier a token 2021-11-18 22:21:52 -08:00
Greg Shuflin
44cebec818 For expr 2021-11-18 22:12:13 -08:00
Greg Shuflin
7e2b95593f Named structs 2021-11-18 21:02:33 -08:00
Greg Shuflin
58a1782162 While expr 2021-11-18 20:08:46 -08:00
Greg Shuflin
6454cc5ad1 block template 2021-11-18 19:12:28 -08:00
Greg Shuflin
d5cd0dada7 Impl, interface 2021-11-18 19:01:09 -08:00
Greg Shuflin
65c745fb30 Annotations 2021-11-18 18:31:33 -08:00
Greg Shuflin
33573bf268 More updates, bump derivative version 2021-11-18 18:24:06 -08:00
Greg Shuflin
12a7fe3e3e Type decl stuff 2021-11-18 17:16:39 -08:00
Greg Shuflin
7f3b4a727f Decls 2021-11-18 16:45:26 -08:00
Greg Shuflin
7a8ab3d571 Full ast parsing 2021-11-18 15:17:47 -08:00
Greg Shuflin
b7b4e75f01 Extended exprs 2021-11-18 14:38:29 -08:00
Greg Shuflin
7a9e43bf8e Various other expr stuff 2021-11-18 04:01:40 -08:00
Greg Shuflin
a666ac985b List literal 2021-11-18 03:32:01 -08:00
Greg Shuflin
37e85c417e String literal 2021-11-18 03:16:43 -08:00
Greg Shuflin
fc088923c0 More test work 2021-11-18 01:37:05 -08:00
Greg Shuflin
8ace37c5cf Start hooking up comb to tests 2021-11-18 00:32:53 -08:00
Greg Shuflin
c1e6bc8c4c MOre work 2021-11-17 16:44:09 -08:00
Greg Shuflin
d37be75478 Rustfmt 2021-11-17 12:45:55 -08:00
Greg Shuflin
f1ffeb155a Get fresh IDs from span 2021-11-17 12:45:42 -08:00
Greg Shuflin
222e0aad08 Use location 2021-11-17 04:43:02 -08:00
Greg Shuflin
77030091bb Add nom_locate 2021-11-17 04:38:00 -08:00
Greg Shuflin
b4b1a0cf63 various work 2021-11-17 03:40:43 -08:00
Greg Shuflin
a2d5f380a8 Continuing work on combinator 2021-11-17 03:27:05 -08:00
Greg Shuflin
1cdaaee9a6 Using nom parser 2021-11-17 01:04:11 -08:00
Greg Shuflin
e6a9811ee5 Fix error.rs 2021-11-14 04:57:37 -08:00
Greg Shuflin
f4029fe31a Make tests not directly dependent on peg 2021-11-14 04:35:04 -08:00
Greg Shuflin
d38bb2278c Rename new.rs -> peg_parser.rs 2021-11-14 04:25:24 -08:00
Greg Shuflin
96393604c3 Move parser crate items around 2021-11-14 03:55:35 -08:00
Greg Shuflin
29207876ae Get rid of old BNF grammar in doc comments
Eventually add this back in some form
2021-11-14 03:49:57 -08:00
Greg Shuflin
b0795f2dd4 Flatten crate heirarchy 2021-11-14 03:47:18 -08:00
greg
3b20b9e209 Put schala-lang crates into a subdirectory 2018-10-17 14:51:48 -07:00
greg
de0e150536 Fix if-block parsing to handle newlines 2018-10-17 13:44:29 -07:00
greg
baf51fb147 Boolean patterns 2018-10-17 12:43:09 -07:00
greg
dc9e493fa1 Handle more patterns at reduce_ast level 2018-10-16 17:18:03 -07:00
greg
d57a8045a9 Rename test helper 2018-10-16 04:11:18 -07:00
greg
50d5176b45 Fix bug add test 2018-10-16 04:10:28 -07:00
greg
501eaeee87 Implement numeric pattern matching 2018-10-16 03:54:08 -07:00
greg
8619c94217 Start handling numeric patterns
Still need to add eval support for this
2018-10-16 01:38:41 -07:00
greg
9927a6b1fd Implement custom interpreter directives - and a wtf?
See the comment about &mut self vs &self
2018-10-15 20:29:23 -07:00
greg
abe2db25b2 full if matching working with basic patterns 2018-10-15 19:54:17 -07:00
greg
a99a5f10a4 Indicate index explicitly in SymbolTable debug 2018-10-15 19:37:02 -07:00
greg
80eb703f5e Finally got get_doc hookup in codegen macro working 2018-09-29 01:20:31 -07:00
greg
4fccff5e27 Working on improved proc_macro handling 2018-09-27 04:07:42 -07:00
greg
5d4505241a get rid of completed todo 2018-09-22 00:26:38 -07:00
greg
f67793308e Part of the work for a doc handler 2018-09-22 00:24:27 -07:00
greg
693766fa59 Proc macros are stable now 2018-09-21 19:46:31 -07:00
greg
1abbe2e448 Add guard to Alternative
The semantics are:
    -if tag is Some(_), assume the condition is a constructor,
    and compare tags
    - if guard is Some(_), evaluate true/false *after* having
    applied any bound variables

With this, I can technically get rid of bare conditionals now, since
they are the same as an Alternative with a None tag
2018-08-27 12:45:08 -07:00
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