~jojo/Carth

ref: 65fedc5ad30893bac36f128dac201ff7081f8e1b Carth/examples d---------
Update std with undefined & panic functionality
Make Pair a builtin datatype
Disallow []. Add "case" keywords to match-expression to read better
Add basic import system. Basically C-style include
Allow integer and boolean literals in patterns

Could exploit the existing Match.PCon constructor to represent not
just datatypes, but these other enumerables as well. Didn't have to
make many additions/modifications at all -- quite nice!
Complete (bad-ish) fizzbuzz!
Impl sizeof ourselves instead of relying on messy getTypeAllocSize

The problem with the earlier approach was that we had to pull in the
IO-related EncodeAST monad in our Gen stack, and the implementation to
call getTypeAllocSize was kind of messy, as llvm-hs didn't expose it
other than in an Internal module.

EncodeAST in Gen (and Gen') prevented use of `mfix`, which I needed.

Also note that we had to change Map.Strict to Map, as, of course, we
can't have recursive bindings in the strict Map.
Pass `byval` when passing by reference

So instead of

LLVM:
  declare @foo(%Foo* %x)

Rust:
  extern fn foo(x: &Foo) { ... }

we do

LLVM:
  declare @foo(%Foo* byval %x)

Rust:
  extern fn foo(x: Foo) { ... }

It just seemed like a nice thing to do, especially now that
we (mostly?) conform to C calling convention / System V ABI.
Don't greedily mark every call as tail -- causes segfaults & stuff!

For now, don't mark any call as tail. Gotta learn how it really works
first. Seems like only calls that are actually in tail-position should
be marked as tail, or mayhem ensues.
Rename main to start & fix start-related stuff

First, the reason for the rename. Having both an "outer" and an
"inner" main named main (with LLVM kindly generating some suffix to
separate them) was just not very pretty looking. Another problem was
that, while not possible before, e.g. recursing in main would not
work, as the main found would not be the inner main, but the outer
main. Renaming the inner (user defined) main to start alleviates this
issue.

Another approach we could've taken is to rename the outer main, and
tell the linker (via GCC/Clang) that we have another entrypoint than
main. I started working on this, but just appending a "-e outer_main"
flag was no good. The problem was that the entrypoint changed was not
main to outer_main, but rather _start to outer_main. This was no good,
as _start usually sets up some things before calling main, and the
result was segfaults.

Also, now start (main) is treated more like any other global def, and
you can call main from other functions and recurse etc. I had to fix
how main is typechecked a bit for this to work correctly.
Add beginnings of fizzbuzz example

Currently makes use of recursive datatype and box/deref.
foreign-core: Add macro def_carth_closure! for convenience

The definitions don't really end up shorted, but it's all a bit more
overviewable. Lower chance of mixing up names I think.
Add FFI functions display-inline, str-append

Also add hello-world.carth, making use of these.
Add external item declarations

To test it out, change print-int from being a builtin to being an
extern function.
Reimplement foreign core library in Rust

Because Rust is much nicer than C.
Fix test.carth
Add pos to errors in `unify`
Improving handling of main not defined error

Don't fail in the parser, but in the checker etc.
Add pos to error of undefined variable
Add pos to error for undefined constructor
Next