search for: start_line

Displaying 2 results from an estimated 2 matches for "start_line".

2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
...[ [ defns = LIST0 defn; "do"; run = expr -> defns, run ] ]; END open Printf let program, run = try Gram.parse prog Loc.ghost (Stream.of_channel (open_in "fib.ml")) with | Loc.Exc_located(loc, e) -> printf "%s at line %d\n" (Printexc.to_string e) (Loc.start_line loc); exit 1 open Llvm let ( |> ) x f = f x type state = { fn: llvalue; blk: llbasicblock; vars: (string * llvalue) list } let bb state = builder_at_end state.blk let new_block state name = append_block name state.fn let find state v = try List.assoc v state.vars with...
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