Commit Graph

536 Commits

Author SHA1 Message Date
greg
82520aa28d Start to add source map insertions 2019-10-23 14:47:18 -07:00
greg
129d9ec673 A bunch of infrastructure for keeping track of AST node locations
Plus a failing test to illustrate the reason we care
2019-10-23 14:47:18 -07:00
greg
7825ef1eb9 Partial module work 2019-10-23 14:47:18 -07:00
greg
f3ecdc61cb Remove old TODO 2019-10-23 02:22:10 -07:00
greg
bf59e6cc63 Just import all of AST in parse tests 2019-10-22 03:15:41 -07:00
greg
c560c29b2d Start to add module syntax 2019-10-22 03:15:14 -07:00
greg
4dcd9d0198 Some more parse trace improvements 2019-10-22 02:11:49 -07:00
greg
7ac63160c5 Remove extraneous debug print 2019-10-21 19:19:48 -07:00
greg
8656992945 Made parse trace output a bit nicer
Used ... instead of whitespace, removed extraneous "Production"
2019-10-21 19:18:47 -07:00
greg
bb87a87848 Remove this TODO; default args are parsed 2019-10-21 10:53:17 -07:00
greg
2f467702e3 Use common scope resolver
So that if you import something at the repl, it stays imported
2019-10-21 04:19:26 -07:00
greg
5ac5425fac Use symbol table handle in resolver 2019-10-21 04:17:30 -07:00
greg
944916d6af Alias for symbol table handle type 2019-10-21 04:09:43 -07:00
greg
3906210db8 Fix prelude 2019-10-21 03:26:38 -07:00
greg
f7357d4498 Add explicit panic for prelude errors
Maybe I want to handle this better in the future, but for now just panic
if the prelude is bad for some reason.
2019-10-21 03:25:45 -07:00
greg
1493d12a22 Reduce unused imports 2019-10-21 03:02:11 -07:00
greg
016d8fc900 Fixed tests
but I think importing is still not working properly
2019-10-21 02:56:21 -07:00
greg
86dc5eca02 Get rid of symbol segment kind
I don't think I need this after all
2019-10-18 18:24:57 -07:00
greg
e75958c2a2 Currently broken import all commit 2019-10-18 09:55:26 -07:00
greg
7a56b6dfc0 Add some more methods around this 2019-10-18 09:54:56 -07:00
greg
f9633ebe55 Add (broken) import all test 2019-10-18 09:53:44 -07:00
greg
854740a63f SymbolTrie 2019-10-17 03:15:39 -07:00
greg
ca10481d7c Symbol table test - multiple values 2019-10-16 22:46:58 -07:00
greg
26fa4a29ec Put type names into symbol table 2019-10-16 20:22:40 -07:00
greg
97b59d7e70 Symbol table tests to separate file 2019-10-16 19:51:43 -07:00
greg
92ad4767c8 Remove some extraneous code 2019-10-16 10:39:48 -07:00
greg
7cabca2987 Got all tests passing with visitor scope-resolver 2019-10-16 02:46:32 -07:00
greg
98e53a6d0f Start porting ScopeResolution to use Visitor pattern 2019-10-15 19:06:07 -07:00
greg
77cc1f3824 ASTVisitor imports 2019-10-15 19:03:27 -07:00
greg
9e64a22328 Invocation argument in visitor 2019-10-15 18:58:51 -07:00
greg
5afdc16f2e Still more visitor work 2019-10-15 03:51:36 -07:00
greg
f818e86f48 More visitor work 2019-10-15 00:53:21 -07:00
greg
7c75f9b2a8 Extraneous comment 2019-10-11 18:45:52 -07:00
greg
2c34ab52c4 Make this test conform to new if syntax 2019-10-11 09:13:09 -07:00
greg
44d1f4692f Add back parser restrictions 2019-10-11 09:11:14 -07:00
greg
3cf3fce72d Fixed some code in scope resolver 2019-10-10 18:33:34 -07:00
greg
ddea470ba8 Parsing tests pass, eval ones fail 2019-10-10 18:17:59 -07:00
greg
745afe981a Got compilation working again 2019-10-10 17:50:20 -07:00
greg
a6c86d6447 Some work 2019-10-10 17:06:41 -07:00
greg
8d3639ab8e Fix everything if-refactor-related save reduced_ast 2019-10-10 14:38:48 -07:00
greg
3bca82a8c8 Still more refactoring work 2019-10-10 10:34:54 -07:00
greg
811c52c8d3 More if-expr refactoring work
Think I finished all the parsing stuff, just need to fix the types
everywhere else
2019-10-10 03:56:35 -07:00
greg
95e278d1b5 Chunk of work on if-expr AST
don't expect this to compile yet
2019-10-10 03:29:28 -07:00
greg
61b757313d Alter grammar of if-blocks 2019-10-10 02:34:56 -07:00
greg
2ed84de641 Introduce bare else clause in if exprs
With a non-passing test
2019-10-09 01:50:32 -07:00
greg
22efd39114 Change if-expr syntax
use else instead of ->
2019-10-08 18:23:16 -07:00
greg
a48bb61eb3 Get rid of this test
need to rethink how if-expressions should work
2019-10-05 16:41:51 -07:00
greg
904d5c4431 Add "production" line to parse debug output
And also add a .next() in the parser that should've been there
2019-10-04 03:12:09 -07:00
greg
28056b1f89 Add production name in ParseError
for debugging
2019-10-04 03:12:00 -07:00
greg
f9a59838b0 Get rid of .into()'s in parser 2019-10-01 02:19:12 -07:00
greg
f02d7cb924 Add test for failing if expression 2019-09-28 17:42:22 -07:00
greg
c427646e75 Change type alias 2019-09-28 02:42:18 -07:00
greg
f06b5922de Visitor cleanup 2019-09-28 02:37:36 -07:00
greg
253b5d88f0 Finish cleaning up visitor logic 2019-09-28 01:58:22 -07:00
greg
f654cd6b50 Start moving all walking logic out of visitor 2019-09-28 01:01:56 -07:00
greg
89649273d8 Still more visitor stuff 2019-09-27 22:34:00 -07:00
greg
9fa4e3797c More visitor stuff 2019-09-27 09:54:24 -07:00
greg
c8804eeefb More visitor stuff 2019-09-26 03:26:37 -07:00
greg
d80a0036b1 Enough of ASTVisitor to test something 2019-09-26 02:29:35 -07:00
greg
39bb175722 Initial WIP code 2019-09-26 01:31:39 -07:00
greg
ae65455374 Add type alias for name scope data structure 2019-09-25 03:26:31 -07:00
greg
1fc028c9fc Make lookup_name_in_scope a method 2019-09-25 03:18:54 -07:00
greg
031ff9fe7e Add top-level variable to schala prelude 2019-09-25 02:54:56 -07:00
greg
5a9f3c1850 Sort symbols in debug 2019-09-25 02:43:07 -07:00
greg
58251d3f28 Use colored in symbol table debug 2019-09-25 02:28:24 -07:00
greg
2e42313991 add_new_symbol clarification 2019-09-25 02:18:36 -07:00
greg
0b57561114 Use block in scope resolution 2019-09-25 01:45:02 -07:00
greg
dbd81ca83d names 2019-09-24 19:24:07 -07:00
greg
6368d10d92 Rename Symbol.name -> Symbol.local_name
to make it clearer what this means
2019-09-24 18:56:53 -07:00
greg
9cd64d97a5 Isolate import handling code 2019-09-24 18:42:01 -07:00
greg
41cad61e34 Start work on name resolution 2019-09-24 03:28:59 -07:00
greg
a054de56a2 Import statement syntax 2019-09-21 02:30:28 -07:00
greg
603ea89b98 Start adding import keyword 2019-09-20 18:19:29 -07:00
greg
06026604cc Fix test 2019-09-20 12:14:15 -07:00
greg
03f8abac6a Remove Meta type 2019-09-20 12:03:42 -07:00
greg
fd3922d866 Get rid of Meta from tests 2019-09-20 10:10:57 -07:00
greg
71b3365de2 Remove all the rest of the instances of Meta from the AST
Still need to do tests
2019-09-20 02:21:39 -07:00
greg
cf9ce74394 still more meta's 2019-09-20 02:05:57 -07:00
greg
f5d1c89574 Kill more Meta's 2019-09-20 02:03:10 -07:00
greg
8d1e0ebdea Start to get rid of Meta 2019-09-20 01:57:48 -07:00
greg
69c215eac9 Get rid of Meta elsewhere 2019-09-20 01:44:20 -07:00
greg
8a34034819 Symbol table map for NamedStruct 2019-09-20 01:36:58 -07:00
greg
403b171c72 remove another meta-use 2019-09-20 01:08:00 -07:00
greg
e5a09a6ee8 Get rid of Meta use in reduce_named_struct 2019-09-19 18:38:15 -07:00
greg
e1a83b5de3 Start to use table lookups instead of Meta
For fqsn
2019-09-19 03:34:09 -07:00
greg
8b1dd561f2 Add get_fqsn_from_id opposite lookup method 2019-09-19 03:06:49 -07:00
greg
6ebe893acb Add id_to_fqsn table on symbol table 2019-09-19 02:58:52 -07:00
greg
c9052e0a3b QualifiedName with id 2019-09-19 01:34:21 -07:00
greg
56e6eb44f9 Finish adding ItemId to Expression 2019-09-18 14:15:05 -07:00
greg
642f21d298 WIP commit - adding ItemId to Expression 2019-09-18 10:09:33 -07:00
greg
c12cb99b24 ItemId on statement 2019-09-18 10:07:20 -07:00
greg
8dc8833eb3 Item Id store 2019-09-18 09:56:11 -07:00
greg
b517bc2366 Add ItemId type to AST 2019-09-18 02:15:45 -07:00
greg
73519d5be5 Add derivative crate 2019-09-18 01:58:38 -07:00
greg
8b6de6961f ItemId type 2019-09-18 01:52:43 -07:00
greg
3eaeeb5509 Begin deprecating Meta in favor of an ItemId 2019-09-17 14:32:15 -07:00
greg
b91c3c9da5 Change design of Statement AST node 2019-09-17 02:25:11 -07:00
greg
08da787aae Make AST a struct 2019-09-11 19:25:12 -07:00
greg
a85d3c46bd Finish conversion of AST Reducer 2019-09-11 01:27:52 -07:00
greg
25f51a314d Start transitioning design of ast reduction
to method-on-struct based system
2019-09-10 09:27:33 -07:00
greg
6c3a4f907b Warning cleanup, TODOs 2019-09-10 03:40:41 -07:00
greg
22887678bd Remove lookup_by_name 2019-09-10 03:35:11 -07:00
greg
1ecf1e506c Update more notes 2019-09-10 03:33:28 -07:00
greg
72944ded1b Fixed all broken tests 2019-09-10 03:31:23 -07:00
greg
b65779fb93 Add symbol_table to scope_resolution 2019-09-09 18:12:14 -07:00
greg
418d77770f Start adding symbol_table to scope resolution 2019-09-09 17:45:34 -07:00
greg
5572e0eebb Make some notes about what to do next 2019-09-09 10:17:46 -07:00
greg
65bc32b033 Fixed many of the broken tests 2019-09-09 01:04:46 -07:00
greg
29f4060a71 VarOrName fix in reduced ast 2019-09-08 17:01:07 -07:00
greg
09dbe5b736 Rename function 2019-09-08 04:27:04 -07:00
greg
cfa65e5339 Wire up all the qualified names 2019-09-08 02:11:15 -07:00
greg
9a28ccfd85 Tests compile again 2019-09-07 19:08:50 -07:00
greg
ea542192be Temp qualified names work 2019-09-06 17:19:41 -07:00
greg
79635f2f86 Add Meta annotation to QualifiedName 2019-09-06 10:03:50 -07:00
greg
2b5b1589b0 tests compile, 15 fail 2019-09-06 02:30:18 -07:00
greg
44c073320b Code builds, tests don't 2019-09-06 02:23:04 -07:00
greg
c04e4356a1 Changing how patterns work
to support qualified names in patterns
2019-09-04 10:53:52 -07:00
greg
24e0ecbe73 partial work 2019-09-03 21:14:12 -07:00
greg
fd66a9711d More work on fully-qualified names 2019-09-03 10:23:38 -07:00
greg
a5c9aca4d7 Halfway done with fqsn lookup pass initial work 2019-09-03 03:20:17 -07:00
greg
cefaeb1180 Make ScopeResolver struct 2019-09-03 02:59:19 -07:00
greg
724237545f Start work on scope resolver 2019-09-03 02:19:37 -07:00
greg
0f7f5cb416 Add new stage scope-resolution 2019-09-03 01:42:28 -07:00
greg
b4da57f5c5 Make Meta<Expression> exist everywhere it needs to 2019-09-02 14:41:09 -07:00
greg
8b87945bee Wrap remaining Expressions in Meta 2019-09-02 14:13:53 -07:00
greg
f96469178d Tests for qualified names 2019-09-01 01:07:00 -07:00
greg
34abb9b081 Start work on qualified names 2019-08-31 23:39:01 -07:00
greg
89d967aee4 FullyQualifiedSymbolName string representation 2019-08-30 22:55:59 -07:00
greg
0540df4024 Rename Val -> Sym 2019-08-30 19:10:16 -07:00
greg
61182a847f Rename lookup_by_path -> lookup_by_fqsn 2019-08-30 19:05:01 -07:00
greg
f6dcd7f0b8 Use proper symbol_table lookup in eval 2019-08-30 19:03:52 -07:00
greg
16dc973aa6 Remove one use of symbol_table.lookup_by_name
Should aim to remove it entirely
2019-08-30 18:56:16 -07:00
greg
611e46938d Make symbol names better
Refactor of symbol table to make name lookups
more precise, necessary for struct member lookups
2019-08-30 18:41:47 -07:00
greg
3d6447abb4 Start work on symbol table lookup by type name 2019-08-21 10:10:57 -07:00
greg
a74027bb1f Start adding object access 2019-08-20 00:20:07 -07:00
greg
583e87c19a Make apply_builtin compatible with Node 2019-08-19 21:49:46 -07:00
greg
12ed2f5c8e Pass symbol table reference to to_repl 2019-08-19 19:38:24 -07:00
greg
3caf9c763c Move eval tests 2019-08-16 10:39:21 -07:00
greg
cd20afc3c7 Add note about Nodes 2019-08-15 08:07:52 -07:00
greg
063a13f7ff Move BinOp into ast subcrate
now builtins is only builtin semantics and has nothing to do with
operators
2019-08-15 06:28:40 -07:00
greg
b0a1f3337c Clean up some operator code 2019-08-14 10:31:07 -07:00
greg
2e147e141e Update a bunch of schala-lang libraries 2019-08-14 10:18:35 -07:00
greg
44938aa4e6 Starting to refactor binop 2019-08-14 09:26:08 -07:00
greg
44ae10b7ae Add todo note 2019-08-14 07:54:39 -07:00
greg
fa1544c71f Fix eval of negatives 2019-08-14 07:31:59 -07:00
greg
fde169b623 Make operators live in a submodule of ast
Starting with PrefixOp, BinOp happens next
2019-08-14 07:25:45 -07:00
greg
6e92b03f81 Add types for (some) builtins 2019-08-13 04:28:21 -07:00
greg
0dd6b26e5a Move where PrefixOp lives 2019-08-13 04:17:17 -07:00
greg
a3bb3ee514 Note a bug 2019-08-12 14:13:20 -07:00
greg
7ae41e717d Switch away from string builtins 2019-08-12 14:10:07 -07:00
greg
24089da788 Mapping names to builtins 2019-08-12 13:49:39 -07:00
greg
bfb36b90e4 Start refactoring how builtins work
Create an enum of builtin operations to start with
2019-08-12 13:10:22 -07:00
greg
e750247134 Successfully constructing a record
Not yet destructing it
2019-08-12 12:46:18 -07:00
greg
a8efe40b57 Add some documentation for the reduced AST 2019-08-12 11:55:35 -07:00
greg
c9bfa2b540 More named struct reduction work 2019-08-12 11:40:16 -07:00
greg
e708c728d2 Add a type to the prelude to test records 2019-08-12 11:33:03 -07:00
greg
b65d6e4c8e Symbol table notes to self 2019-08-12 11:27:16 -07:00
greg
d9eca8ffb3 Handle records more properly in symbol table 2019-08-12 11:18:03 -07:00
greg
a600d34712 More work on named struct
commented for now becuase I need to fix things in the symbol table
2019-08-12 10:59:04 -07:00
greg
aae2ee53cd More parsing debugging changes 2019-08-12 09:51:36 -07:00
greg
bf3dcc18d0 Fixed trace parsing debug output 2019-08-12 09:34:36 -07:00
greg
baf499ee5a Fix symbol-table debugging 2019-08-05 03:37:37 -07:00
greg
3b19fc5aa9 Barest beginning of named struct implementation 2019-08-05 03:35:10 -07:00
greg
16bf166fa9 Fix bug with debug specifications 2019-08-05 03:31:10 -07:00
greg
d832583ed9 Fix pluralization wording 2019-08-05 01:11:01 -07:00
greg
87ecc6f0cb Don't print out bare constructor
Instead convert to PrimObject
2019-08-05 01:07:48 -07:00
greg
ee87695626 Simplify Alternative data structure
Most of the subfields are duplicated on Subpattern so just use that
directly
2019-07-30 01:33:09 -07:00
greg
b62968379a Replace matches with functional constructs 2019-07-28 11:15:28 -07:00
greg
aa705b4eee Break out actual lib.rs functionality
To minimize the amount of meaningful text in files with generic names
2019-07-11 19:21:23 -07:00
greg
d67ccf5c7a Refactor Expression struct
to have explicit kind and type_anno fields, to make it clearer
that this represents source-code level annotation and not any kind
of type inference intermediate product
2019-07-10 18:52:25 -07:00
greg
10e40669b5 Fix parsing debug options again 2019-06-22 12:33:28 -07:00
greg
6d3f5f4b81 Got things compiling again
But this is a bad design for the DebugAsk
2019-06-19 10:41:20 -07:00
greg
e3bd108e6c Debug stuff 2019-06-19 03:27:18 -07:00
greg
2ec3b21ebf Make output_wrapper more concise 2019-06-18 18:11:17 -07:00
greg
b6e3469573 Default argument to function 2019-06-16 21:36:59 -07:00
greg
32fe7430a4 Equals should be a token type 2019-06-16 16:07:27 -07:00
greg
c332747c3e Move parse test code into separate module 2019-06-16 15:03:34 -07:00
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