summaryrefslogtreecommitdiff
path: root/compile.ml
blob: e05f18888be27fbf4d24b4b8643bcd726fba9f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
open Format
open Mips
open Ast
open Utils
open Closure

let rec compile_expr _ = {text = [] ; data = []}
and compile_letfuns _ = {text = [] ; data = []}

let compile a ofile =
    let a2, letfuns = replace_funcs a
    in
        let program = merge_programs (compile_letfuns letfuns)
                                     (compile_expr a2)
        and f = open_out ofile
        in
            let fmt = formatter_of_out_channel f in
            in
                    format_program fmt program;
                    close_out f