Include macro expansion trace in SrcPos. Better err msgs!
In expansion of macro.
Add primitive, single pattern macros
E.g. `(defmacro (plus a b) (+ a b))`
Make parser act on token trees instead of chars
Replace Parse.parseTokenTreeOrRest with Lex.tokentree in Err
Fix typo in GenErr variant (NoBulitin... -> NoBuiltin...)
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.
Add builtin virtual `cast` to cast between all primitive num types
So between integers of different sizes, from float to int, and from
int to float. Also almost accidentally includes casting to and from
enums, as they are seen as integers at the time the types are fully
checked in genCast.
Positioned error msgs instead of ICE for bad inst of builtin virtual
Change formatting: 90 cols, IndentPolicyFree, etc. Add brittany.yaml
Most people have pretty wide and high res screens at this point. I
can't fit two windows with 100 line length next to eachother with my
font size, but 90 works and most people have smaller font size than me
Also, change brittanys indentation policy to Free. This almost always
looks better. I just had to disable formatting of imports -- I don't
want to align those, but IndentationPolicyFree insists.
Finally, actually add a project-local brittany config file, so that
anyone (or me in the future / on another computer) can use the same
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)
(: 13.37 F64)
Rename start to main by mapping "main" to "_main" in mangleName
I tried having the carth-level entrypoint be called "main" before, but
it didn't work out since I tried having it compile to "main", and then
add a wrapping main that compiled to something like "outer_main", and
then redefine the entrypoint to "outer_main" when calling clang. That
was messy due to startfiles-related issues, but this way of simply
mapping "main" to "_main" via mangleName seems to work really well!
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
Simplify error-region parsing in TypeErr using tokenTree everywhere
Remove not-really-needed deps llvm-hs-pretty & prettyprinter
They weren't unused, but very unimportant. We can do things in a very
slightly worse way if it means simplifying our dependency graph!
Add error for duplicate var defs at top-level and in let
Separate Ast Pretty instances from Ast.hs to PrettyAst.hs
Check definedness & arity of TConsts in type defs
Thought I checked definedness before within assertNoRec, but that
check was only for "top-level" tconsts within a constructor.
Add basic import system. Basically C-style include