~jojo/Carth

ref: 749208029494a7c48ce04444a513424f4b998416 Carth/app d---------
Less desugaring in Parse (do in Infer instead), more concrete Parsed.

Step towards improving error messages. Among others, the function-related ones can
end up misleading due to bad SrcPos:s given to nodes generated from desugaring.
Add macro rules and ellipsis (...) macro operator
Add primitive, single pattern macros

E.g. `(defmacro (plus a b) (+ a b))`
Make parser act on token trees instead of chars
Begin work on lexer

I feel like adding a token(tree)izer for mainly two reasons.

1. Separation of concerns. Parsing code will be simpler if we can
   separate out the lexing part.

2. In preparation for macros. Macros should act on token trees, so
   creating an in-between step is pretty much needed.

Currently, Lex.hs and Lexd.hs work and feel pretty much done, but
they're not connected to the rest of the compiler. What remains is to
rewrite Parse.hs to act on TokenTree:s instead of parsing text from
scratch.
Add skeleton module Optimize between Monomorphize & Compile
Test that good programs produce expected output

For the programs in test/tests/good/, compile and run the program,
capturing stdout. If the string of stdout matches the text in the
first comment of the file, the test passes.
Test that examples and benchmarks compile

So now, `stack test` will: test that programs in test/tests/bad/ don't
typecheck, and fail with the expected error variant; test that
programs in examples/ compile; and test that programs in test/bench/
compile.

Next: test that programs in test/tests/good/ run and produce the
expected output.
Add `transmute` special form

Use to change the type of an expression without modifying the bits in
any way -- just interpret them as if they represented the new type.

Example:
    (: (transmute (: 4623716258932001341 Int)) F64)
results in
    (: 13.37 F64)
Add `--verbose` flag. Don't print stuff when off.
Actually, do remove showing git commit in version

Idk it's just bothersome to package
Remove package.yaml in favor of just carth.cabal

It's annoying having to type out all modules in exposed-modules, but
still, this means a bit less complexity.
Run with MCJIT with `carth run`
Add `carth version`. Bake package.yaml version & commit into binary

Bake uses templatehaskell. At compiletime of the carth compiler,
version numbers are read from package.yaml and commit hash & date is
gotten from shell command.

Something to keep in mind is that the file with the baked values is
not recompiled by default. Luckily it was solved easily. Any
modification of package.yaml forces rebuild, so changing version in
the file will change version in the binary. To force recompilation
when git status changes, use templatehaskell "command"
`qAddDependentFile ".git/index"`, which seems to add that file to some
watchlist in the metadata of the compiled library? It works anywho.
Improve module names. Ast -> Parsed, AnnotAst -> Inferred, and more
Check user-written types in Infer

Basically, do `checkType` for user-written types. It detects
references to undefined types. Also, separete AnnotAst.Type from
Ast.Type to help enforce that this is done. This whole ordeal required
some refactoring.
Add --debug flag to write debug files (e.g. .dbg.ll)
Read env vars of lib path and module path at runtime

Before they were compiled into the `carth` binary, but to work with
Guix in the future, I feel it's better to allow the paths to be
changed arbitrarily by the user/system without recompilation.
Prefix debug files (like out.ll) with ".dbg." to make invisible

Also gitignore them
Next