The Liva compiler

This is a compiler project based on MicroC and Dice. It is coded in OCaml and needs the Ocaml llvm library to run. 

------------------------------
LLVM Installation under Ubuntu 15.10

sudo apt-get install -y ocaml m4 llvm opam
opam init
opam install llvm.3.6 ocamlfind
eval `opam config env`
------------------------------

For installation under OS X, please refer to the MicroC compiler’s README file which can be found at http://www.cs.columbia.edu/~sedwards/classes/2016/4115-summer/index.html 

To run and test:
$ make liva
ocamlfind ocamlopt -c -package llvm ast.ml
ocamlfind ocamlopt -c -package llvm sast.ml
ocamlyacc parser.mly
ocamlc -c ast.ml
ocamlc -c parser.mli
ocamlfind ocamlopt -c -package llvm parser.ml
ocamllex scanner.mll
127 states, 6605 transitions, table size 27182 bytes
ocamlfind ocamlopt -c -package llvm scanner.ml
ocamlfind ocamlopt -c -package llvm semant.ml
ocamlfind ocamlopt -c -package llvm codegen.ml
ocamlfind ocamlopt -c -package llvm liva.ml
ocamlfind ocamlopt -linkpkg -package llvm -package llvm.analysis ast.cmx sast.cmx parser.cmx scanner.cmx semant.cmx codegen.cmx liva.cmx  -o liva

You may need run chmod +x testall.sh to unlock the shell script.
$ ./testall.sh
-n test-add...
OK
-n test-and...
OK
...
-n fail-sub...
OK
-n fail-while1...
OK


Write a small program and test it.
test.liva:
class calculator{
    int addition(int x, int y){    
        int z;
        z = x + y;
        return(z);
    }
}

class test {
    void main(){
        int result;
        class calculator obj = new calculator();
        result = obj.addition(31,79);
        print ("result=",result,"\n");
    } 
}

$ ./liva < test.liva > test.ll
$ lli test.ll
result=110

