Commit graph

73 commits

Author SHA1 Message Date
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
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
9ce5794c30 [fine] Panic embeds description, start match 2024-03-24 07:08:45 -07: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
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
aac5c6257f [fine] Generic garbage 2024-02-11 18:44:41 -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
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
65ec2d4cca [fine] Implement the wildcard pattern 2024-02-04 19:36:47 -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
ba5b37f5ff [fine] Parse is expression, partially 2024-02-02 06:32:03 -08:00
afa4812074 [fine] Parse alternate types 2024-02-01 07:56:30 -08:00
f7acfd588d [fine] Even more resilience, I can stop now
Also fix a bug, could not return from a method OOPS
2024-02-01 06:35:43 -08:00
7f30d0ccc3 [fine] More resilience
We don't lose function declarations and whatnot, although we get lost
with broken return types.
2024-01-31 07:46:20 -08:00
93c9dcd13b [fine] Suggestion for improvement in match
No special keyword. Exhaustivity is harder.
2024-01-30 06:39:10 -08:00
f2e82942df [fine] Some resilience, a design improvement for iterator 2024-01-29 10:04:47 -08:00
019d780f85 [fine] Design for "intersection" types 2024-01-28 22:15:13 -08:00
f634e4da18 [fine] Don't panic on this parse error 2024-01-28 22:15:01 -08:00
19e57db724 [fine] Static methods I guess 2024-01-25 06:44:53 -08:00
bc57978dda [fine] No methods assigned to variables! 2024-01-24 09:11:55 -08:00
0c69758b11 [fine] Methods! 2024-01-24 09:03:45 -08:00
2839b43f6d [fine] Improvements to classes
- Classes are defined lazily
- Member access is via environment
- Member access is just a binary expression with a weird environment
- Slot loads look like variable loads now
- Associativity in the parser (ugh)
2024-01-22 23:17:02 -08:00
0d48bfb113 [fine] starting to work on methods 2024-01-22 06:04:13 -08:00
5f0a0b3268 [fine] Many test improvements, error improvements
- Check for more error conditions
- Move to more definitive error assertions
- Simpler error messages in some cases
- Test more conditions more thoroughly, revisit old tests
2024-01-21 08:14:42 -08:00
d0b74db715 [fine] Error checking for some cases 2024-01-20 11:13:22 -08:00
4505996710 [fine] Classes!
It's kinda amazing this works actually
2024-01-20 11:03:33 -08:00
0ee89bf26b [fine] WIP: Classes 2024-01-20 08:56:53 -08:00
e6c96fde38 [fine] Some tests to make work at some point I guess 2024-01-19 21:01:10 -08:00
f20f5a5e03 [fine] Assignments!
And new error capabilities!
2024-01-19 19:08:17 -08:00
92cf840766 [fine] A little more test 2024-01-17 16:10:07 -08:00
9ee8d39963 [fine] Starting on lists, god help me 2024-01-17 15:58:48 -08:00
106f2eb30f [fine] Giving up on generics for now 2024-01-17 09:12:00 -08:00
aaa88717f5 [fine] Error on generic parameters 2024-01-16 19:36:13 -08:00
01798236ec [fine] Compile iteratively instead of recursively 2024-01-16 09:26:05 -08:00
7fb88ef199 [fine] More tests and also comparisons 2024-01-15 09:43:56 -08:00
55749af917 [fine] Some fixes around return statements 2024-01-15 09:04:28 -08:00
44bc072b04 [fine] Test for function return type mismatch 2024-01-15 07:52:49 -08:00
d893002ec2 [fine] Check the return type of functions
A function returns what it says it does, the check is that the body
returns the right value.
2024-01-15 07:46:20 -08:00
257a7e64c2 [fine] More test more! 2024-01-15 07:19:29 -08:00
2f8e1bad85 [fine] More test! 2024-01-14 19:40:47 -08:00
40d611ae37 [fine] Fix block compilation 2024-01-14 19:19:53 -08:00