Skip to content

Commit

Permalink
Merge branch 'template'
Browse files Browse the repository at this point in the history
  • Loading branch information
glyh committed Sep 19, 2024
2 parents 164fb15 + e0ddcb8 commit b38b2d3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
3 changes: 2 additions & 1 deletion MiniMoonBit.g4
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ value_expr:
| not_expr
| array_make_expr;
unit_expr: '(' ')'; // ()
tuple_expr: '(' expr (',' expr)* ')'; // (x, y)
tuple_expr:
'(' expr (',' expr)+ ')'; // (x, y); 1-tuple is not allowed
block_expr: '{' stmt '}'; // { blah; blah; }
bool_expr: 'true' | 'false';
neg_expr: '-' value_expr;
Expand Down
4 changes: 2 additions & 2 deletions riscv_rt/src/start.zig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const std = @import("std");
const lib = @import("./lib.zig");

extern fn mincaml_main() void;
extern fn minimbt_main() void;

pub fn main() void {
lib.init_allocator();
mincaml_main();
minimbt_main();
lib.deinit_allocator();
}
2 changes: 1 addition & 1 deletion test/test_src/cls-rec.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ fn f(y: Int) -> Int {

fn main {
print_int(f(12))
};
};
2 changes: 1 addition & 1 deletion test/test_src/even-odd.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ fn even(x: Int) -> Int {

fn main {
print_int(even(789))
};
};
14 changes: 7 additions & 7 deletions test/test_src/matmul-flat.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ fn mul(l: Int, m: Int, n: Int, a: Array[Array[Double]], b: Array[Array[Double]],

fn main {
let dummy = Array::make(0, 0.0);
fn init(i: Int, n: Int, mat: Array[Array[Double]]) -> Unit {
fn init_arr(i: Int, n: Int, mat: Array[Array[Double]]) -> Unit {
if 0 <= i {
mat[i] = Array::make(n, 0.0);
init(i - 1, n, mat)
init_arr(i - 1, n, mat)
} else {
()
}
};
fn make(m: Int, n: Int, dummy: Array[Double]) -> Array[Array[Double]] {
fn make_arr(m: Int, n: Int, dummy: Array[Double]) -> Array[Array[Double]] {
let mat = Array::make(m, dummy);
let _ = init(m - 1, n, mat);
let _ = init_arr(m - 1, n, mat);
mat
};
let a = make(2, 3, dummy);
let b = make(3, 2, dummy);
let c = make(2, 2, dummy);
let a = make_arr(2, 3, dummy);
let b = make_arr(3, 2, dummy);
let c = make_arr(2, 2, dummy);
a[0][0] = 1.0; a[0][1] = 2.0; a[0][2] = 3.0;
a[1][0] = 4.0; a[1][1] = 5.0; a[1][2] = 6.0;
b[0][0] = 7.0; b[0][1] = 8.0;
Expand Down
14 changes: 7 additions & 7 deletions test/test_src/matmul.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ fn matmul(l: Int, m: Int, n: Int, a: Array[Array[Double]], b: Array[Array[Double

fn main {
let dummy = Array::make(0, 0.0);
fn make(m: Int, n: Int) -> Array[Array[Double]] {
fn gen_arr(m: Int, n: Int) -> Array[Array[Double]] {
let mat = Array::make(m, dummy);
fn init(i: Int) -> Unit {
fn init_arr(i: Int) -> Unit {
if 0 <= i {
mat[i] = Array::make(n, 0.0);
init(i - 1)
init_arr(i - 1)
} else {
()
}
};
let _ = init(m - 1);
let _ = init_arr(m - 1);
mat
};
let a = make(2, 3);
let b = make(3, 2);
let c = make(2, 2);
let a = make_arr(2, 3);
let b = make_arr(3, 2);
let c = make_arr(2, 2);
a[0][0] = 1.0; a[0][1] = 2.0; a[0][2] = 3.0;
a[1][0] = 4.0; a[1][1] = 5.0; a[1][2] = 6.0;
b[0][0] = 7.0; b[0][1] = 8.0;
Expand Down

0 comments on commit b38b2d3

Please sign in to comment.