Commit graph

271 commits

Author SHA1 Message Date
25f9c3ecaf [fine] Parser Table Generator?
Look I'm just thinking hard about converting to a parser generator
because I want to derive the pretty-printer from the parser without
having to repeat myself all over the place.

This parser.py is derived from my old LRParsers project, and should
go back there eventually, but for now I'm driving the work from here.
2024-05-04 16:58:07 -07:00
a2b3e8b74d [fine] Remove salsa dependency 2024-04-07 07:00:02 -07:00
228ca719f0 [fine] Start on a pretty printer
ala https://justinpombrio.net/2024/02/23/a-twist-on-Wadlers-printer.html
2024-04-06 18:25:57 -07:00
0b0b5d72d0 [fine] Tokens are by reference, ephemera
It's another jump, perhaps, but smaller arrays, and now we can track
ephemera efficiently without bloating child trees. (We could also
put ephemera inline with the child trees but then nth_token would be
unwieldy, and it would lower our data density.)
2024-04-06 17:39:33 -07:00
a5173be680 [fine] ICE should be cold and far away from the world 2024-04-06 15:20:30 -07:00
24b827b5ac [fine] This frame should not show up as the ICE panic cause 2024-04-06 15:19:32 -07:00
52e1879ef4 [fine] Loader takes Option<base>, global module map
Just some hacking on modules
2024-04-06 10:00:22 -07:00
a3d4c24f11 [fine] Multi-module compilation
It's a little bit complicated, loading a module is a two-step dance
but here's how it's done. Probably some surface-area refactoring needs
to happen so that we do the right thing.
2024-03-30 16:33:27 -07:00
ab477cd783 [fine] Simplify function compilation
This is simpler because we don't "discover" functions to compile as we
go, we just compile all the ones we can find, and functions have
pre-defined exports. This is good and useful to us as we can now refer
to functions in different modules by known indices, but it *does* make
me wonder what we're going to do for compiling generic specializations.
The previous technique was better for that sort of thing.

This is all predicated on the idea that I want to have
partially-compiled modules, which I can't really say why I want it. If
I'm happy to just compile things cross module in the same kind of
space then it's much easier to go back to the function key way of
working.
2024-03-29 19:12:18 -07:00
4c061fbd28 [fine] Lookup semantics by mid
This isn't actually correct, I really need a global view to make this
right.
2024-03-29 06:30:02 -07:00
2c03989da3 [fine] Working on rebuilding declarations
Running into walls dealing with imported declarations, thinking maybe
this structure will help me.
2024-03-28 16:56:42 -07:00
f3a8203be3 [fine] Remove dead code 2024-03-25 09:26:08 -07:00
13bb04238f [fine] Remove extra printf 2024-03-25 09:24:52 -07:00
85ffc0c7dd [fine] All error sentinels carry diagnostics
The system has an invariant that if you ever return an error
sentinel (error environment, error type) then that sentinel is caused
by an error that was reported to the user. We have had too many bugs
over the last little while where that was not the case!

(An example is if we mis-interpret the tree by calling `nth_tree` with
the wrong index or something, and get `None`, and think "oh must be a
syntax error", but it was really just the wrong index. Then there's an
error sentinel with no error diagnostic and we don't discover the
mistake until much farther along.)

Now we enforce this by requiring that whoever constructs the error
sentinel *prove* that they can do so by providing a diagnostic. It's
less efficient but prevents the problem.

This actually uncovered a couple of latent bugs where we were
generating error sentinels instead of a more appropriate type! Whoops!
2024-03-25 08:07:18 -07:00
8779aade24 [fine] Report errors with environments, fix match bug
I'm worried that this will turn into something I always have to do
instead of something I just do sometimes: always provide the
provenance of some error type or another. Link error types to
diagnostics, etc.
2024-03-24 08:15:33 -07:00
2ba34701ac [fine] Note about panics and error messages 2024-03-24 07:48:23 -07:00
c4b4273115 [fine] Compiler flows error descriptions on tree errors
Like, even when the tree is malformed lets try to talk about what we
found. This is still not right, but it's better maybe.
2024-03-24 07:45:34 -07:00
9ce5794c30 [fine] Panic embeds description, start match 2024-03-24 07:08:45 -07:00
548d9387d6 Don't let git get weird 2024-03-24 07:08:08 -07:00
7cc625dd01 Configuration updates for vendoring 2024-03-08 11:04:23 -08:00
977e3c17e5 Vendor things 2024-03-08 11:03:01 -08:00
5deceec006 chore: reorganize as a workspace 2024-03-08 10:16:54 -08:00
60e8f64c01 [fine] Imports maybe
Feels a little sketchy
2024-03-07 20:07:41 -08:00
1199646e29 [fine] File name in error messages
Going to need to normalize that name though, because right now it
really *really* sucks to have a big \\?\ kinda name. Probably
normalize it relative to the base directory.
2024-02-15 06:36:14 -08:00
a21f18da6e [fine] export, dump source map, lookup fix 2024-02-15 06:29:56 -08:00
a3ae4339cf [fine] Many more import-related shuffles 2024-02-15 06:12:18 -08:00
994268abb6 [fine] Oh no a runtime and module loading and stuff
Lots of test work to use the new mechanism. I'm not sure I like it.
2024-02-12 22:49:34 -08:00
2093502031 [fine] Tests to drive import work 2024-02-11 18:45:01 -08:00
aac5c6257f [fine] Generic garbage 2024-02-11 18:44:41 -08:00
692af9f93d [fine] Bring back some test coverage 2024-02-11 09:39:49 -08:00
2dbdbb3957 [fine] Lifetime garbage, big refactor
So it turns out that I can't hold `&str` in token because it makes it
impossible to encapsulate a source file in the larger context- self
referential structure problems again. Everything gets rebuilt so that
the source can be passed through. While we're at it, more things
become Rc<> because, man..... life it too short.

Semantics in particular has become a giant hub of the module state: we
can basically just hold an Rc<Semantics> and have everything we could
possibly want to know about a source file, computed lazily if
necessary.
2024-02-11 09:31:51 -08:00
d5059dd450 [fine] List iteration... works?
A little hacky but it works!
2024-02-08 22:25:00 -08:00
13aaca36c8 [fine] Fix list variable binding 2024-02-08 06:34:02 -08:00
09a85596d8 [fine] Just some more tests 2024-02-07 10:09:36 -08:00
b43947b6f1 [fine] Conditionals produce alternates (yikes!) 2024-02-07 07:58:36 -08:00
8b9a69b898 [fine] Increasingly elaborate alternate types 2024-02-07 07:47:20 -08:00
5f67aa72d5 [fine] Remember to use this function 2024-02-07 06:11:25 -08:00
723b231b0d [fine] Constant eval, use for loop type analysis 2024-02-07 02:57:53 -08:00
239e859eaf [fine] Support assignment to member, loops with iterators
Hmm it's starting to look like something.
2024-02-07 01:57:41 -08:00
3415b1a3f6 [fine] Here are some tests 2024-02-05 06:13:32 -08:00
ac3c158a81 [fine] While loops, nothing 2024-02-05 06:11:37 -08:00
1cc5ce6ca9 [fine] Clean up warnings 2024-02-04 20:22:31 -08:00
a8ab907eee [fine] A lot more typing/environmenting, doing better on example
Time to start actual tests
2024-02-04 20:19:08 -08:00
28ec6b5e85 [fine] Improve wildcard parsing, fix ephemera bug with peek_next 2024-02-04 20:04:55 -08:00
65ec2d4cca [fine] Implement the wildcard pattern 2024-02-04 19:36:47 -08:00
e0721d09fc [fine] Notes on patterns 2024-02-04 19:13:56 -08:00
deed9d9a45 [fine] Starting on pattern matching, make patterns explicit 2024-02-04 07:47:16 -08:00
f00b9e22e7 [fine] Bindings in if remain in scope! 2024-02-03 09:54:46 -08:00
198dc5bdb3 [fine] Evaluate is expressions, SO MANY BUG FIXES 2024-02-03 09:38:28 -08:00
b5b56b49a9 [fine] fix some bugs, semantics for is 2024-02-03 07:59:49 -08:00