Commit Graph

15 Commits

Author SHA1 Message Date
3687785540 [checkpoint] Start the switch to type inference. 2023-06-19 21:16:28 -07:00
b931ba5b17 Add a quick check of our cast validation. 2023-06-17 17:34:45 -07:00
758766b491 Add a validator check that the types named in casts are reasonable. 2023-06-17 17:28:55 -07:00
e6ae0ab277 Get rid of Expression::Value and Expression:Reference, just folding in ValueOrRef directly. 2023-06-17 15:57:36 -07:00
041c0a497e Add support for casting. 2023-06-17 15:10:16 -07:00
b4ad24030f Get unary negation working. 2023-06-07 21:38:18 -07:00
469fe35e46 Add support for multiple integer types. 2023-06-04 17:31:26 -07:00
7efd2fb796 Add a code generator for making tests of the examples. 2023-06-04 17:29:59 -07:00
8aa1465c35 Prep the way for type casting. 2023-05-13 15:03:47 -05:00
9f8050a559 Add lexer support for angles, which we'll use for casting. 2023-05-13 15:03:38 -05:00
c0b65ef416 Add type suffixes to numbers in the lexer. 2023-05-13 15:03:31 -05:00
1fbfd0c2d2 📜 Add better documentation across the compiler. (#3)
These changes pay particular attention to API endpoints, to try to
ensure that any rustdocs generated are detailed and sensible. A good
next step, eventually, might be to include doctest examples, as well.
For the moment, it's not clear that they would provide a lot of value,
though.

In addition, this does a couple refactors to simplify the code base in
ways that make things clearer or, at least, briefer.
2023-05-13 15:00:08 -05:00
f4594bf2cc 🧪 Add evaluation tests to ensure that passes retain NGR semantics. (#2)
This change adds `Arbitrary` instances to the key IR data types (both as
syntax and as native IR), as well as evaluator functions for both. This
way, we can ensure that the evaluation of one version of the IR is
observationally equivalent to another version of the IR, or even a later
IR. It also adds a similar ability through both static file compilation
and the JIT, to ensure that the translation through Cranelift and our
runtime works as expected.

This actually found a couple issues in its creation, and I hope is
helpful extensions into more interesting programs.
2023-05-13 15:00:08 -05:00
99fb12910f 🤖 Make Github Actions work (#1) 2023-05-13 15:00:08 -05:00
b2f6b12ced 🤷 The initial version of the compiler, both static and JIT.
This implements a full compiler, with both static compilation and JIT
support, for the world's simplest and silliest programming language. You
can do math, and print variables. That's it. On the bright side, it
implements every part of the compiler, from the lexer and parser;
through analysis and simplification; and into a reasonable code
generator. This should be a good jumping off point for adding more
advanced features.

Tests, including proptests, are included to help avoid regressions.
2023-05-13 15:00:02 -05:00