Skip to content

Commit

Permalink
Imcgen: Add intermediate code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenart12 committed Apr 3, 2023
1 parent 8c822c0 commit a706d6b
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 48 deletions.
14 changes: 14 additions & 0 deletions prev23/prg/mem_test.p23
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,17 @@ in {
a4(l1, l2, l3);
a3(l1, l2)
};

fun f1(p1: int): int = let
var l1: int;
fun f2(p2: int): int = let
var l2: int;
fun f3(p3: int): int = let
var l3: int;
in {
l1 + l2 + l3 + f1(p1) + f2(p2) + f3(p3)
};
in
l1 + l2 + f1(p1) + f2(p2);
in
l1 + f1(p1);
5 changes: 3 additions & 2 deletions prev23/prg/type_test.p23
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ fun test_decl(): char = let typ __char = _char; var c3: __char; in c3;
fun test_block(): ^char = {
test_ass_void();
test_while_void();
^test_decl()
test_decl();
"prev23"
};

typ deep_record = {
Expand Down Expand Up @@ -242,7 +243,7 @@ fun test_rgb(r1: ^r, g1: ^g, b1: ^b) : bool = (r1 == g1) & (r1 == b1) & (g1 == b
fun test_lvalue_ptr(i1: ^int): void = i1^ = 5;
# fun test_lvalue_const(): void = 5 = 4;
# fun test_lvalue_ptr_error(i1: int): void = ^i1 = (nil: ^int); # Error
fun test_warn_non_lvalue_ptr(): ^int = ^5;
fun test_warn_non_lvalue_ptr(): ^int = ^v1;


fun f(): int = f();
Expand Down
Loading

0 comments on commit a706d6b

Please sign in to comment.