Commit Graph

264 Commits

Author SHA1 Message Date
Scott Richmond
a275757eac wire up stub:w prelude from external file 2025-06-20 14:43:14 -04:00
Scott Richmond
9c7a3f603f base and stub prelude wired up 2025-06-20 14:30:39 -04:00
Scott Richmond
f244b97c4a work on prelude; update tailcall to deal properly with base fns 2025-06-20 14:29:31 -04:00
Scott Richmond
518c194cc6 load base into a compiler 2025-06-20 12:53:16 -04:00
Scott Richmond
fac7d71732 fix argument order in base fns 2025-06-20 12:49:31 -04:00
Scott Richmond
062e7d5126 recursion works, so does mutual recursion; function call bugfixes 2025-06-20 12:32:15 -04:00
Scott Richmond
c3199fe716 notes and todos 2025-06-20 00:56:43 -04:00
Scott Richmond
50a3aa9a61 fix binding bug 2025-06-20 00:33:25 -04:00
Scott Richmond
bd36e21bd8 find a bug in function bindings; TCO is maybe complete?; things are in a shambles 2025-06-19 21:47:58 -04:00
Scott Richmond
838dc68d48 improve panic traces; tail calls work for simpel calls 2025-06-19 21:13:18 -04:00
Scott Richmond
1600311e47 tail calls work now? also print stack trace on panic 2025-06-19 20:52:19 -04:00
Scott Richmond
430e29a608 fix upvalue resolution, start work on TCO 2025-06-19 20:29:15 -04:00
Scott Richmond
fdb4713d98 rought draft of splatted fn args 2025-06-19 18:26:44 -04:00
Scott Richmond
66534a2429 dict splatterns first draft 2025-06-19 15:56:23 -04:00
Scott Richmond
bdce1a76ef pseudocode splatted dict algo 2025-06-19 12:44:29 -04:00
Scott Richmond
2b92046c4a first draft of tuple splatterns 2025-06-19 12:37:29 -04:00
Scott Richmond
e44cf56860 first draft of list splatterns 2025-06-19 12:18:09 -04:00
Scott Richmond
3c8e7c10d5 first stab at splatted lists 2025-06-19 12:06:47 -04:00
Scott Richmond
7d900b5bc6 add match splatted list opcode 2025-06-19 11:54:26 -04:00
Scott Richmond
0de01e3e17 update punch list 2025-06-19 11:48:50 -04:00
Scott Richmond
c2e9e018b4 rough draft of new version of loop w/ 16 bit jumps 2025-06-18 19:03:45 -04:00
Scott Richmond
97157813b1 update repeat w/ new jumps 2025-06-18 17:50:30 -04:00
Scott Richmond
8e8c457ce6 panic on wrong number of args to functions 2025-06-18 16:47:53 -04:00
Scott Richmond
81730af988 match now uses new jump; micro-optimize pop_n 2025-06-18 15:24:30 -04:00
Scott Richmond
4ec35b6dc9 update dict pattern for new jumps 2025-06-18 15:00:46 -04:00
Scott Richmond
95acb3361a update list pattern compiling to reflect new jump logic 2025-06-18 14:52:15 -04:00
Scott Richmond
f129eca045 tuple patterns now use jump_stub and patch_jump, with 16 bit jump values 2025-06-18 14:47:00 -04:00
Scott Richmond
9e3c71fcb2 chip away at 16-bit jump instructions 2025-06-18 14:12:54 -04:00
Scott Richmond
36033de22f VM instructions now take 3 bytes 2025-06-18 14:12:10 -04:00
Scott Richmond
8c865c87c0 add jump fn for 16 bit jump 2025-06-18 13:15:57 -04:00
Scott Richmond
2a45348d74 remove unused pattern.rs 2025-06-18 13:15:39 -04:00
Scott Richmond
2aad460f28 test out 16 bit operand math 2025-06-06 00:11:08 -04:00
Scott Richmond
73d94101d7 first draft of complex string matching, discover jump mistake 2025-06-05 23:26:42 -04:00
Scott Richmond
55ca86b6a3 fix InterpolatedPattern compilation 2025-06-05 21:23:08 -04:00
Scott Richmond
d330fc3046 first draft of partial application, is working in easy cases 2025-06-05 16:45:23 -04:00
Scott Richmond
d4bda075d8 start work on partial application, fix/abstract binding resolution 2025-06-05 16:10:40 -04:00
Scott Richmond
0b0e869d85 add dict splats 2025-06-05 13:24:32 -04:00
Scott Richmond
8d3e817b6e add list splats 2025-06-05 13:05:07 -04:00
Scott Richmond
41a54523c3 add do forms 2025-06-05 12:15:49 -04:00
Scott Richmond
a0e184dee7 fix extra pop regression 2025-06-05 12:04:02 -04:00
Scott Richmond
32f7a036cd save work, working on function clause guards, extra pop instructions are showing up after function definitions 2025-06-04 19:02:19 -04:00
Scott Richmond
1e295cb483 guards work in match forms 2025-06-04 18:55:40 -04:00
Scott Richmond
e32f4a0226 guards work in match forms 2025-06-04 18:51:07 -04:00
Scott Richmond
5660d62aff let as last expr in block now returns rhs; clean up some comment cruft 2025-06-04 18:27:17 -04:00
Scott Richmond
8909f7350b closures work?! 2025-06-04 17:53:38 -04:00
Scott Richmond
911702f4bf add a print builtin/opcode 2025-06-03 19:26:01 -04:00
Scott Richmond
3f48d2e49f implement multiterm synthetic expressions 2025-06-03 19:13:40 -04:00
Scott Richmond
aaa9ab2e98 start pulling base fns into bytecode interpreter 2025-06-03 18:54:33 -04:00
Scott Richmond
6e6fc1030b function calls: first draft, worked out the obvious bugs 2025-06-03 17:30:00 -04:00
Scott Richmond
1b462ce8ce keywords and interned strings use &'static str instead of indexes into vecs 2025-06-03 16:23:37 -04:00
Scott Richmond
85338bcbf9 basic function calls, still with bugs! 2025-06-03 15:48:13 -04:00
Scott Richmond
5075e118c0 vm.chunk -> vm.callframe.chunk 2025-06-02 13:34:23 -04:00
Scott Richmond
d85fce26da maybe properly compile functions? need to start work on fn calls to test 2025-06-01 20:01:42 -04:00
Scott Richmond
da9a71e85e start major work on function compilation 2025-05-30 17:02:55 -04:00
Scott Richmond
d9eedb7ba0 add as patterns 2025-05-30 14:57:51 -04:00
Scott Richmond
663435e223 add string interpolation 2025-05-30 11:44:32 -04:00
Scott Richmond
e2617de4e9 or and and are now reserved words 2025-05-28 16:37:25 -04:00
Scott Richmond
0d48509c51 add builtins, fix basic synthetic expressions 2025-05-27 14:15:12 -04:00
Scott Richmond
472010c526 first draft loop/recur, seems to work? 2025-05-26 11:03:37 -04:00
Scott Richmond
efefa77b6e return register now an 8-member array 2025-05-26 09:16:47 -04:00
Scott Richmond
bccafbd4ab update repeat 2025-05-26 08:32:33 -04:00
Scott Richmond
943eaf22fe dict patterns prolly work? one-level nested patterns work 2025-05-25 19:14:34 -04:00
Scott Richmond
7725e5546c rough, not yet working, draft of dict patterns 2025-05-25 19:09:21 -04:00
Scott Richmond
9d1ccb1c00 add list patterns, fix dict stack mechanics 2025-05-25 16:30:20 -04:00
Scott Richmond
47b553a300 properly compile when expressions? 2025-05-23 17:59:09 -04:00
Scott Richmond
9921d02945 compiler: decouple stack & bindings resetting 2025-05-23 13:43:35 -04:00
Scott Richmond
db4c537db6 compiler: decouple stack & bindings resetting 2025-05-23 13:42:29 -04:00
Scott Richmond
55361dd7c1 oh god, so many changes. working on tuple matching 2025-05-23 00:09:35 -04:00
Scott Richmond
2b39b1b54b take some loop notes 2024-12-27 00:54:31 -05:00
Scott Richmond
6cbe253f6e vm::run is now a loop, not vm::interpret as a tailcall 2024-12-27 00:47:22 -05:00
Scott Richmond
420415f984 add match_depth to vm 2024-12-27 00:22:01 -05:00
Scott Richmond
ce77b25ac7 refactor if/else to match in guard compilation 2024-12-26 23:48:38 -05:00
Scott Richmond
9ae2e8eca2 compile guards in match forms 2024-12-26 23:46:06 -05:00
Scott Richmond
0719e4a276 fix block compilation; compile & run repeat 2024-12-26 23:33:57 -05:00
Scott Richmond
774df695d9 separate compiler & chunk 2024-12-26 19:03:09 -05:00
Scott Richmond
e37b562c93 notes and comments 2024-12-26 18:41:54 -05:00
Scott Richmond
05abe64e45 working & thinking 2024-12-24 12:35:44 -05:00
Scott Richmond
d3df1e8ed2 continue work on compiling functions 2024-12-23 10:55:28 -05:00
Scott Richmond
5618cf9ef8 get lifetime out of Chunk, thus out of Value 2024-12-22 19:51:02 -05:00
Scott Richmond
e8a90c5356 get simple match forms done 2024-12-22 19:33:59 -05:00
Scott Richmond
068a8aa724 do lots of work 2024-12-22 19:07:42 -05:00
Scott Richmond
27443444e3 get binding & pretty debugging working 2024-12-18 01:28:23 -05:00
Scott Richmond
044c7264f8 do work 2024-12-17 23:45:39 -05:00
Scott Richmond
e61d07efa6 add untracked from opening bytecode branch 2024-12-15 23:50:12 -05:00
Scott Richmond
bbe38e6bf6 DRY out validator, simplify code 2024-12-15 23:49:43 -05:00
Scott Richmond
e13c5a5ba3 finish list of valid types 2024-12-15 23:49:27 -05:00
Scott Richmond
d0afa3a547 make some progress: atoms and ifs 2024-12-15 23:28:57 -05:00
Scott Richmond
2aa9892d25 some simple bytecodes! 2024-12-15 17:54:40 -05:00
Scott Richmond
3cddbac42c start working on a bytecode interpreter! 2024-12-15 16:37:51 -05:00
Scott Richmond
6388aae0fa things & stuff 2024-12-14 13:43:08 -05:00
Scott Richmond
70ecebcbe9 fix print! 2024-12-13 13:47:03 -05:00
Scott Richmond
0d741ee6fa bring full prelude into Ludus. 2024-12-12 19:43:56 -05:00
Scott Richmond
90493f4346 fix loop validation bugs 2024-12-12 19:28:55 -05:00
Scott Richmond
1e74ef8237 improve panic reports 2024-12-12 19:01:51 -05:00
Scott Richmond
78266114e7 a slow and brute-force approach to the problem of re-binding closed-over forward declarations 2024-12-12 01:19:39 -05:00
Scott Richmond
ac119a848c ariadne hooked up to panic messages 2024-12-12 00:31:57 -05:00
Scott Richmond
d28a7adbfa fiddle 2024-12-11 19:13:06 -05:00
Scott Richmond
c1a594a939 refactor process to use visit method everywhere 2024-12-11 19:11:40 -05:00
Scott Richmond
b85df7a83c process now uses spans, for to give panic locations 2024-12-11 18:58:59 -05:00
Scott Richmond
a248a56f6e stash changes before ripping up a bunch of stuff 2024-12-11 17:37:42 -05:00
Scott Richmond
ddff9b6884 start debugging full prelude 2024-12-11 17:32:31 -05:00
Scott Richmond
7dab0e0637 closing works, so does importing from Prelude! 2024-12-11 17:22:37 -05:00
Scott Richmond
ca0c4062c3 get closing working? 2024-12-11 16:43:13 -05:00
Scott Richmond
6f4b269bdb follow clippy 2024-12-11 15:48:24 -05:00
Scott Richmond
9410997886 add args to processes 2024-12-11 15:45:34 -05:00
Scott Richmond
3eb9178854 context -> process 2024-12-11 15:42:50 -05:00
Scott Richmond
4b783bc5ef validator validates recursive functions 2024-12-11 15:36:23 -05:00
Scott Richmond
acaf726675 arity checking--of local functions 2024-12-11 00:20:34 -05:00
Scott Richmond
2f8f3f687c complete first draft of validator 2024-12-10 23:42:05 -05:00
Scott Richmond
dd57f49f80 cover all Ast branches 2024-12-10 22:40:57 -05:00
Scott Richmond
c40f0f45d2 move patterns, clauses into AST 2024-12-10 22:26:52 -05:00
Scott Richmond
07096abc7d start moving Patterns into Ast 2024-12-10 18:40:43 -05:00
Scott Richmond
26f3b66b33 loop arity checking 2024-12-10 18:07:31 -05:00
Scott Richmond
1e88d803a3 improve do & recur errs 2024-12-10 17:39:02 -05:00
Scott Richmond
8016f9f0bd first draft of synthetic validation 2024-12-10 17:23:15 -05:00
Scott Richmond
c5ec437452 start testing, fixing 2024-12-10 17:14:26 -05:00
Scott Richmond
7a800c7905 all the work trying to write a validator 2024-12-10 16:44:52 -05:00
Scott Richmond
1e48de112c actually commit the big new file 2024-12-08 23:33:46 -05:00
Scott Richmond
fc8896908d many refactorings; unfucked lifetimes? 2024-12-08 23:33:02 -05:00
Scott Richmond
df4fc68326 type alias for Context 2024-12-08 00:02:01 -05:00
Scott Richmond
1a620c3682 finish fighting with lifetimes: string pattern matching works! 2024-12-07 23:56:19 -05:00
Scott Richmond
fec57635e3 fighting with lifetimes 2024-12-07 22:29:10 -05:00
Scott Richmond
cb66806cae parse string patterns, perhaps correctly, perhaps not 2024-12-07 18:26:25 -05:00
Scott Richmond
74db9a7f53 finish base, I think 2024-12-06 14:08:34 -05:00
Scott Richmond
a739dfd794 keep adding to base, pull type function from value to base 2024-12-06 13:21:25 -05:00
Scott Richmond
fb572e4acc tick some boxes 2024-12-05 14:02:41 -05:00
Scott Richmond
531e79d482 add concat 2024-12-05 11:51:42 -05:00
Scott Richmond
04a09c5ccc add some functions, base fns return values, not results 2024-12-04 20:19:41 -05:00
Scott Richmond
1e18da7bd1 ensure inlined and allocated strings are equal 2024-12-04 19:13:25 -05:00
Scott Richmond
d3e026733a complete string interpolation 2024-12-04 19:07:03 -05:00
Scott Richmond
4b3da3d8ba parse interpolated strings 2024-12-04 18:31:13 -05:00
Scott Richmond
045f8cd579 parse interpolated strings 2024-12-04 18:30:03 -05:00
Scott Richmond
da60fed78d add ref-counted string type 2024-12-04 15:03:09 -05:00
Scott Richmond
69583e29d3 parse docstrings 2024-11-21 22:36:57 -05:00
Scott Richmond
03864d5878 update todos 2024-11-21 20:09:37 -05:00
Scott Richmond
b645c7daa6 get right with clippy 2024-11-21 20:00:49 -05:00
Scott Richmond
2801916473 follow clippy 2024-11-21 19:54:50 -05:00
Scott Richmond
eb3b4d487b start looking into memory layout 2024-11-21 18:50:13 -05:00
Scott Richmond
fa0a793458 clean up most warnings 2024-11-21 17:10:50 -05:00
Scott Richmond
b7398a290a interpret loop & recur 2024-11-21 17:02:54 -05:00
Scott Richmond
1c589dcc4a parse loop and recur 2024-11-21 16:57:52 -05:00
Scott Richmond
a4c37582b9 parse loop and recur 2024-11-21 16:41:46 -05:00
Scott Richmond
42b81afef9 add guard clauses to match and fn 2024-11-20 20:10:17 -05:00
Scott Richmond
bf9efc0501 list splatterns! 2024-11-18 20:01:27 -05:00
Scott Richmond
bf2c585d9e tuple splatterns now work 2024-11-18 13:25:54 -05:00
Scott Richmond
2a8b858ff6 update todo list 2024-11-14 22:19:52 -05:00
Scott Richmond
d801b063b5 add as patterns 2024-11-14 21:55:19 -05:00
Scott Richmond
9ccb1b29e4 remove test cruft 2024-11-14 21:31:26 -05:00
Scott Richmond
f2ce24febc get base functions working 2024-11-14 21:30:42 -05:00
Scott Richmond
ef7b5ca9ac lots of work, need to fix cloning closures in base 2024-11-11 17:50:58 -05:00