ref: 55fb4f948f1f3797078b584dc60b4f7dd68b37ed Carth/carth.cabal -rw-r--r-- 4.1 KiB
Duplicate AST defs from Monomorphic to Low

Also had to add a bunch of basically no-op translation in Lower.hs
just to fix the types. Atm it's pointless, but it will serve as a base
to work on as the Low AST drifts from the Monomorphic AST.
rename Optimize{,d} -> Low{er,}
Update stackage release & use default-extensions in cabal file

Also, fix some minor breakages caused by ghc update, fix the
literate.org example, fix some new warnings, and get rid of the need
for a bunch of Data implementations by using basic parsing functions
in SystemSpec.hs.
Update carth.cabal to reflect move to sourcehut and .md README
Add primitive, single pattern macros

E.g. `(defmacro (plus a b) (+ a b))`
Make parser act on token trees instead of chars
Reorder build-depends in cabal to clarify which are test only deps
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
Elim need for mods LLCompunit, LLSubprog with DuplicateRecordFields

They only existed to reexport a subset of LLOp in order to avoid name
collisions in record fields. The language extension
DuplicateRecordFields eliminates the need for this, by using magic to
disambiguate when there are duplicate fields in different records in
the same module.
Add skeleton module Optimize between Monomorphize & Compile
Make GC_malloc take NatSize instead of IntSize

I mean, how the heck do you allocate a negative amount of memory, right?
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.
Extract tests from CheckSpec to individual files in test/tests/bad

SystemSpec now runs those and verifies the type errors match what's expected
Define carth type literals only once in TypeAst

Like mainType, tUnit, etc. Use the class TypeAst to allow them to
construct any Type, e.g. Parsed.Type.
when debug, write file ".dbg.gen.ll"
Change domain from carth.jo.zone to carth.pink
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.

    (: (transmute (: 4623716258932001341 Int)) F64)
results in
    (: 13.37 F64)
Better printing of verify exception
Instead of ccc everywhere, generate fastcc wrappers around externs


- Extern declarations can now be written in a carth
  interpretation, with currying and all, because the generated wrapper
  will be curried. No need to manually write curried wrappers!

- Fastcc is faster and can optimize tail calls *way* better than
  ccc. We now have almost guaranteed tail call elimination in most
  possible cases.


- Carth functions can now not be called from the outside, as they
  don't conform to the C abi. Maybe we'll add a feature to generate
  "reverse-wrappers" for marked carth functions.
Move non-AST related codegen operations to Gen.hs

Before, it was a bit unclear exactly where Gen.hs ended and Codegen.hs
began. Now it's a little more clear, though still slightly
ambiguous. Gen.hs contains codegen operations that may be useful when
manually generating stuff, so almost like an abstraction above
llvm-hs. Codegen describes how LLVM code is generated for a
Monomorphic AST using the generation operations in Gen.hs.