Commit Graph

918 Commits

Author SHA1 Message Date
Greg Shuflin 81859306b3 Add tree walk eval test 2021-10-24 21:54:08 -07:00
Greg Shuflin b365a3fec7 WIP if-expression reduction 2021-10-24 21:15:58 -07:00
Greg Shuflin 37ce12b6d8 Handle lambdas 2021-10-24 19:05:41 -07:00
Greg Shuflin 4193971303 Handle lambdas in reduced IR 2021-10-24 18:59:00 -07:00
Greg Shuflin 7282a38a08 Function application working again 2021-10-24 18:02:44 -07:00
Greg Shuflin 16164c2235 Move reduced ir types to separate file 2021-10-24 15:59:40 -07:00
Greg Shuflin f2c9cf20cb More builtins 2021-10-24 07:12:48 -07:00
Greg Shuflin c9cfc467b0 Got (some) arithmetic working again 2021-10-24 06:56:16 -07:00
Greg Shuflin 3383921c6b Evaluator work 2021-10-24 06:36:16 -07:00
Greg Shuflin 7a7e4ec0f2 Use Primitive type in evaluator 2021-10-24 06:07:02 -07:00
Greg Shuflin bd698629ff Continuing work on reduced ir 2021-10-24 05:50:04 -07:00
Greg Shuflin 82de5c6e27 Handle local variables and function params in symbol table 2021-10-24 02:02:04 -07:00
Greg Shuflin 9540dc70f2 Successfully refactor the ScopeResolver tables 2021-10-24 01:06:40 -07:00
Greg Shuflin ba09919aa1 Bunch of rewrites to scope resolver 2021-10-24 00:08:26 -07:00
Greg Shuflin d8f6c41f04 Start re-writing reduced ast and evaluator 2021-10-23 21:18:40 -07:00
Greg Shuflin e68331fe0a Make methods on Visitor public
And remove comment
2021-10-23 21:14:13 -07:00
Greg Shuflin e947569100 Rewrite Visitor
And implement the scope resolver in terms of it
2021-10-23 01:02:36 -07:00
Greg Shuflin 92a695e523 Eliminate one table in SymbolTable 2021-10-21 21:55:21 -07:00
Greg Shuflin b342213826 Add ids to type Variants 2021-10-21 20:00:26 -07:00
Greg Shuflin b4f765167b Redesign Variant struct 2021-10-21 19:53:50 -07:00
Greg Shuflin 2256f25482 Add id_to_symbol table to SymbolTable 2021-10-21 19:43:03 -07:00
Greg Shuflin 4ddcbc89ad Parameterize type of ScopeStack scope names 2021-10-21 19:22:11 -07:00
Greg Shuflin fb31687dea Run rustfmt on symbol_table code 2021-10-21 14:46:42 -07:00
Greg Shuflin 93d0a2cd7d Clippy fix in eval 2021-10-21 12:38:12 -07:00
Greg Shuflin 9b5c3629c0 Update schala-lang to edition 2021 2021-10-21 12:37:29 -07:00
Greg Shuflin b5484e67ee Update to edition 2021
Except there's some issues with parser macros preventing it for
schala-language
2021-10-21 12:33:56 -07:00
Greg Shuflin 248af74ec0 Add parsing for annotations 2021-10-21 11:32:14 -07:00
Greg Shuflin 3b5ebf92b4 Some additional notes 2021-10-21 10:45:14 -07:00
Greg Shuflin 75935db9e6 Get rid of ReducedAST unit
Treat it as the empty tuple instead
2021-10-20 00:18:44 -07:00
Greg Shuflin 2f669b77fd Move reduced_ast.rs into multiple files 2021-10-19 23:18:52 -07:00
Greg Shuflin 0d488b250d Remove submodule 2021-10-19 23:06:52 -07:00
Greg Shuflin 60ddac9774 Rest of clippy lints 2021-10-19 22:29:41 -07:00
Greg Shuflin ae6a79077f more clippy lints 2021-10-19 22:24:27 -07:00
Greg Shuflin 36f06b38de Automatically apply clippy to various util modules 2021-10-19 21:57:14 -07:00
Greg Shuflin c9c65b050c Clippy for parsing 2021-10-19 21:55:51 -07:00
Greg Shuflin 91a7abf4cd Clippy lints for tokenizing.rs 2021-10-19 21:27:05 -07:00
Greg Shuflin 0c6c4ef47e Symbol table clippy 2021-10-19 21:18:57 -07:00
Greg Shuflin 355ed3c749 Rename FQSN -> Fqsn 2021-10-19 21:14:15 -07:00
Greg Shuflin c0a3a03045 Clippy on eval.rs 2021-10-19 21:06:59 -07:00
Greg Shuflin f8c2e57b37 Clippy on reduced_ast.rs 2021-10-19 20:56:52 -07:00
Greg Shuflin 49a50deb04 Run rustfmt on schala.rs 2021-10-19 20:50:43 -07:00
Greg Shuflin 052a2feb23 schala.rs - clippy lints 2021-10-19 20:45:59 -07:00
Greg Shuflin a9b8fdcad6 Track duplicate record definitions 2021-10-19 20:35:53 -07:00
Greg Shuflin 15a08aa8f7 SymbolTable error refactoring 2021-10-19 19:19:21 -07:00
Greg Shuflin 9640a5b05b Use vec of duplicate errors 2021-10-19 18:22:34 -07:00
Greg Shuflin d3378c3210 Use Vec of symbol errors 2021-10-19 18:00:34 -07:00
Greg Shuflin 7a0134014b Switch scope to Rc<String> 2021-10-19 17:22:35 -07:00
Greg Shuflin 3c4d31c963 Reduce complexity of DataConstructor 2021-10-19 16:50:08 -07:00
Greg Shuflin 736aa8aad2 Remove dead code 2021-10-19 16:45:04 -07:00
Greg Shuflin 40f759eea8 Fix all warnings 2021-10-19 14:19:26 -07:00
Greg Shuflin d1d3a70339 Fix last test 2021-10-19 14:12:57 -07:00
Greg Shuflin 3060afd752 Fix warnings 2021-10-19 13:54:32 -07:00
Greg Shuflin 8b724cf0ff Big refactor of symbol table 2021-10-19 13:48:00 -07:00
Greg Shuflin 769ef448e8 Mark out weird oddity with value() in reduced_ast 2021-10-19 00:37:44 -07:00
Greg Shuflin f5328fac9d More work in symbol_table, reduced_ast 2021-10-19 00:07:02 -07:00
Greg Shuflin 1e9a15d01e Some cipppy lints in reduced ast 2021-10-18 23:41:29 -07:00
Greg Shuflin 2609dd404a Tighten up reduced_ast code a bit 2021-10-18 23:10:50 -07:00
Greg Shuflin 845461e2b3 Modify symbol table tests 2021-10-18 23:04:23 -07:00
Greg Shuflin 9d89440a6d Reduce number of tables in symbol table 2021-10-18 22:32:08 -07:00
Greg Shuflin db6c9bb162 Start adding new SymbolTable infrastructure 2021-10-18 21:56:48 -07:00
Greg Shuflin c697c929a4 Use default for ItemId 2021-10-18 17:39:20 -07:00
Greg Shuflin 5bba900a3d Clippy notes in operators.rs 2021-10-16 20:24:36 -07:00
Greg Shuflin 2fe4109296 Change where Builtin is calculated from operators 2021-10-16 20:21:08 -07:00
Greg Shuflin 25bffa339c Adjust some doc comments 2021-10-16 18:05:13 -07:00
Greg Shuflin 6d84675ff8 Move prelude.schala into separate directory 2021-10-14 18:34:26 -07:00
Greg Shuflin f8924cf65f Remove bx! macro from crate root 2021-10-14 17:42:04 -07:00
Greg Shuflin ed6360247d rustfmt on error.rs, lib.rs 2021-10-14 16:54:05 -07:00
Greg Shuflin eeb4e743d2 Move submodules into .mod files in directories 2021-10-14 16:06:41 -07:00
Greg Shuflin 3bb323667d Rename SourceMap -> DeclLocations 2021-10-14 06:55:57 -07:00
Greg Shuflin 69304de998 Various refactors around symbol table 2021-10-14 06:53:36 -07:00
Greg Shuflin fd3a641c71 Fix quick_ast 2021-10-14 06:34:33 -07:00
Greg Shuflin be8633fedb Rename symbol_table 2021-10-14 06:31:52 -07:00
Greg Shuflin ec55e2e8f0 Moving modules around 2021-10-14 06:30:55 -07:00
Greg Shuflin 3ed5f1d16c Refactor SourceMap
Move it into the SymbolTable entirely, make the parser not care about
it.
2021-10-14 06:28:52 -07:00
Greg Shuflin 63360e5617 Token tests 2021-10-14 05:23:24 -07:00
Greg Shuflin 90ede076cc Rustfmt on error.rs 2021-10-14 04:16:20 -07:00
Greg Shuflin 0cb0145cc5 Unified error struct 2021-10-14 04:11:53 -07:00
Greg Shuflin 075e323239 Tokenizing tests 2021-10-14 03:12:05 -07:00
Greg Shuflin fcbf2d959b Treat unclosed comment as error 2021-10-14 03:05:25 -07:00
Greg Shuflin 421a33c42c Use TryFrom<&str> for Tokens 2021-10-14 02:47:19 -07:00
Greg Shuflin 61e2acc338 Parameterize compiler Config type 2021-10-14 02:24:42 -07:00
Greg Shuflin 5dcfce46cc Add Options associated type 2021-10-14 01:34:38 -07:00
Greg Shuflin 3cbe80e933 Parameterize Repl over language type 2021-10-14 01:28:24 -07:00
Greg Shuflin 75b1f9cce5 Working on main compiler pipeline
Got rid of a bunch of confusingly-designed debugging infrastruture.
Need a better way to handle per-stage debug outputs (also I don't want
to be using stages at all long-term)
2021-10-14 00:03:51 -07:00
Greg Shuflin c3131a6d5e WIP thing 2021-10-13 23:45:54 -07:00
Greg Shuflin 7e0acb7d87 Tighten names in Language trait 2021-10-13 01:09:24 -07:00
Greg Shuflin d3ebcc9654 Fix all current warnings 2021-10-13 00:53:32 -07:00
Greg Shuflin 2c64bb6c34 Remove some old externs 2021-10-13 00:49:26 -07:00
Greg Shuflin ec6f4b510e Use resolver 2 2021-10-07 01:33:37 -07:00
Greg Shuflin 77bf42be6c Update to current rust 2021-10-07 00:51:45 -07:00
greg a0955e07dc Fix attribute 2020-02-12 22:14:21 -08:00
greg a2bd9a3985 Remove symbol table from evaluator 2019-11-09 19:52:05 -08:00
greg e4a1a23f4d Moved sym lookup logic from eval to ast reducer 2019-11-09 19:49:02 -08:00
greg 8218007f1c Commit this temporary fix 2019-11-08 18:53:38 -08:00
greg 040ab11873 Move reduction of values into separate method 2019-11-07 03:28:18 -08:00
greg b967fa1911 to_repl() doesn't need symbol table handle 2019-11-07 02:42:17 -08:00
greg 4c718ed977 Add TODO for symbol resolver 2019-11-06 18:41:37 -08:00
greg d20acf7166 Add tokenization for string literal prefixes 2019-11-05 02:22:11 -08:00
greg efc8497235 Rearchitect parser
To ensure that the prelude gets parsed with the same ItemId context as
normal REPL input
2019-10-25 01:49:15 -07:00
greg 4a1987b5a2 Test for modules in symbol table 2019-10-24 03:02:52 -07:00
greg c96644ddce Modules in symbol table 2019-10-24 02:13:07 -07:00
greg cc0ac83709 Refactor a lot of symbol table in prep for modules 2019-10-24 01:34:13 -07:00
greg 3344f6827d Clear out some compiler warnings 2019-10-23 16:07:10 -07:00
greg b38c4b3298 SymbolTable passing, fix test for duplicate line 2019-10-23 14:47:18 -07:00
greg a2f30b6136 Refactored symbol_table test 2019-10-23 14:47:18 -07:00
greg 11a9a60a34 Rejiggering some things with the SourceMap pointer in Parser 2019-10-23 14:47:18 -07:00
greg 5bb1a245c4 Have Parser accept SourceMap reference 2019-10-23 14:47:18 -07:00
greg 1ffe61cf5f Partway there in terms of implementing source map lookup 2019-10-23 14:47:18 -07:00
greg 7495f30e16 Pass SourceMapHandle to SymbolTable 2019-10-23 14:47:18 -07:00
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