This repository has been archived on 2022-12-27. You can view files and clone it, but cannot push or open issues or pull requests.
compilateurMIPS/compiler.ml

14 lines
250 B
OCaml
Raw Normal View History

2022-12-06 20:39:15 +01:00
open Ast.IR
open Mips
2022-12-06 22:22:48 +01:00
module Env = Map.Make (String)
2022-12-06 20:39:15 +01:00
2022-12-08 14:04:46 +01:00
let compile_value = function
2022-12-06 22:22:48 +01:00
| Int n -> [ Li (V0, n) ]
;;
2022-12-06 20:39:15 +01:00
2022-12-08 14:04:46 +01:00
let compile_expr = function
| Val v -> compile_value v
;;
2022-12-06 22:22:48 +01:00
let compile ir = { text = Baselib.builtins @ compile_expr ir; data = [] }