~jojo/Carth

ref: 2219ea535f4a0fd0afd9000ba5c6918c6b276210 Carth/src/Lexd.hs -rw-r--r-- 809 bytes
Add patterns & declaration of literals in macros

Example of a do-notation-like macro using the new features:

    (defmacro do (<-)
      (case (do-bind ma) ma)
      (case (do-bind (<- a ma) mbs ...)
            (do-bind (fun (a) (do do-bind mbs ...)) ma))
      (case (do-bind ma mbs ...)
            (do-bind (fun (_) (do do-bind mbs ...)) ma)))

which can be used like

    (do list/bind
        (<- i (list 1 2 3))
        (<- j (list 1 2 3))
        (if (< i j)
            (list/singleton [i j])
          list/nil))
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.