Skip to content

Commit

Permalink
fix externals
Browse files Browse the repository at this point in the history
  • Loading branch information
glyh committed Sep 17, 2024
1 parent 60faf7b commit 2db36a9
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions src/bin/externals.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,31 @@ fn add_closure_interpreter_fns(

fn externals() -> @immut/hashmap.T[String, @types.Type] {
@immut/hashmap.T::new()
.add("read_int", @types.Fun([], Int))
.add("read_char", @types.Fun([], Int))
.add("print_int", @types.Fun([Int], Unit))
.add("print_char", @types.Fun([Int], Unit))
.add("print_endline", @types.Fun([], Unit))
.add("create_array", @types.Fun([Int, Int], @types.Type::Array(Int)))
.add("read_int", @types.Fun([], @types.t_int))
.add("read_char", @types.Fun([], @types.t_int))
.add("print_int", @types.Fun([@types.t_int], @types.t_unit))
.add("print_char", @types.Fun([@types.t_int], @types.t_unit))
.add("print_endline", @types.Fun([], @types.t_unit))
.add(
"create_array",
@types.Fun([@types.t_int, @types.t_int], @types.Type::Array(@types.t_int)),
)
.add(
"create_float_array",
@types.Fun([Int, Double], @types.Type::Array(Double)),
)
.add("create_ptr_array", @types.Fun([Int, Ptr], @types.Type::Array(Ptr)))
.add("truncate", @types.Fun([Double], Int))
.add("sin", @types.Fun([Double], Double))
.add("cos", @types.Fun([Double], Double))
.add("sqrt", @types.Fun([Double], Double))
.add("abs_float", @types.Fun([Double], Double))
.add("int_of_float", @types.Fun([Double], Int))
.add("float_of_int", @types.Fun([Int], Double))
@types.Fun(
[@types.t_int, @types.t_double],
@types.Type::Array(@types.t_double),
),
)
.add(
"create_ptr_array",
@types.Fun([@types.t_int, @types.t_ptr], @types.Type::Array(@types.t_ptr)),
)
.add("truncate", @types.Fun([@types.t_double], @types.t_int))
.add("sin", @types.Fun([@types.t_double], @types.t_double))
.add("cos", @types.Fun([@types.t_double], @types.t_double))
.add("sqrt", @types.Fun([@types.t_double], @types.t_double))
.add("abs_float", @types.Fun([@types.t_double], @types.t_double))
.add("int_of_float", @types.Fun([@types.t_double], @types.t_int))
.add("float_of_int", @types.Fun([@types.t_int], @types.t_double))
}

0 comments on commit 2db36a9

Please sign in to comment.