Displaying 2 results from an estimated 2 matches for "letrec".
Did you mean:
lebrec
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...mplete 104-line native code compiler for a tiny subset of OCaml
that is expressive enough to compile an external Fibonacci program:
type expr =
| Int of int
| Var of string
| BinOp of [ `Add | `Sub | `Leq ] * expr * expr
| If of expr * expr * expr
| Apply of expr * expr
type defn =
| LetRec of string * string * expr
open Camlp4.PreCast;;
let expr = Gram.Entry.mk "expr"
let defn = Gram.Entry.mk "defn"
let prog = Gram.Entry.mk "defn"
EXTEND Gram
expr:
[ [ "if"; p = expr; "then"; t = expr; "else"; f = expr ->
If(p, t,...
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
Here's my translation of the Fibonacci example into OCaml:
open Printf
open Llvm
let build_fib m =
let fibf =
define_function "fib" (function_type i32_type [| i32_type |]) m in
let bb = builder_at_end (entry_block fibf) in
let one = const_int i32_type 1 and two = const_int i32_type 2 in
let argx = param fibf 0 in
set_value_name "AnArg" argx;
let