- Generate rudimentary DWARF debugging information. GDB is now much
more usable for debugging Carth. Can now view stacktraces with
source locations and see where in the source we are when running
gdb
with-tui
. Can also step source line-by-line, although this is not completely practical as we don’t have sequential statements but rather trees of expressions. - Add subcommand `version`, which simply prints the package version and the commit of the particular build.
Pattern match on strings and uninhabited types
- String literals may be used as patterns, which generates to string-equality tests with the matchee.
- Uninhabited types may be pattern matched on, which is absurd and can be used to imply anything.
- Character literals are removed, as there is not actually any good canonical definition of what a character should be. Is it a codepoint? An ASCII byte? A grapheme cluster? To avoid ambiguity and possible confusion I simply removed it completely.
undefined
now panics instead of recursing until stack-overflow.- Various updates to the standard library.
- Environment variables of library path to search for core in, and module path to search for modules in are now read at runtime instead of when Carth is compiled. This is more dynamic, and will probably play better with Guix in the future.
- Change license to AGPL version 3 or later
Make runnable on others systems & impl C calling convention
Remove hardcoded paths & make the build procedure more general with
a Makefile with configurable variables. Now anyone can simple clone
the repo and run make install
to get a properly built and working
carth
!
Very rudimentary. Not much more fancy than C-style copy-paste
include
.
E.g. (import std)
where std.carth
or std.org
is either in the
same directory as the file being compiled, or in the global module
directory, which is set when compiling Carth and defaults to
~~/.carth/mod~.
Also add a bunch of functions to it, like -str-append
,
display-inline
, add-int
, -panic
, and more.
E.g. (extern -panic (Fun Str Unit))
Carth functions now follow the C calling convention, passing things by reference and returning via register when appropriate, etc. Interfacing with foreign C/Rust/etc code is now almost trivial!
According to ABI, bools are now i8
instead of i1
.
Not much point in keeping it, since it’s not compatible with FFI as-is. Maybe we’ll reimplement it based on LLVM JIT at some point.
E.g. (define (fst (Pair a _)) a)
Nat8
, Nat16
, Nat32
, Nat
, Int8
, Int16
, Int32
.
Like the old Ptr
, but smarter. Also add the special form box
put a value on the heap, and deref
to dereference a box.
Also allow Box
as a special kind of destructor in patterns. Works
as you’d intuitively expect, and dereferences behind the scenes.
In Carth syntax:
(type (Array a) (Array (Box a) Nat))
(type Str (Str (Array Nat8)))
(type (Pair a b) (Pair a b))
- 1 variant => no tag,
- 1 to 256 variants => 8-bit tag,
- 257 to 65536 variants => 16-bit tag,
- etc.
They were treated as variables of name _
before, but duplicate
variable pattern bindings are not allowed!
- More readable name-mangling.
- Perform beta-reduction.
- Other minor improvements that add up!
Otherwise we have two main
:s, and it got messy. Now the
codegenerator generates an “outer” main
which does some stuff,
and the user defines start
.
I thought just marking a call as tail
would do no harm if the
call was not in tail recursion, but it did!
The previous method that ran in the EncodeAST
monad was messy and
stopped working when I needed mfix
for a cyclic binding.
Trying out releases – this is the first one, more or less. Everything has been in such heavy development until now (and still is really, but it has calmed down slightly), so this feels like the first appropriate moment to make a release.
Nothing is ready to use yet, of course, but many of the core components are here. We have parsing with megaparsec, Hindley-Milner typechecking, algebraic datatype definitions and pattern matching with exhaustiveness and redundancy checking, closures, interpretation, and LLVM code generation.
Next up is modules, typeclasses, etc etc.