Fix C code production, add ifzero basic test
This commit is contained in:
parent
3141ce6fde
commit
7c6e2e390e
3 changed files with 4 additions and 1 deletions
|
@ -230,7 +230,8 @@ let rec finish_term (t : S.term) : C.stmt =
|
||||||
)
|
)
|
||||||
| S.IfZero (expr, tIf, tElse) ->
|
| S.IfZero (expr, tIf, tElse) ->
|
||||||
T.IfElse (
|
T.IfElse (
|
||||||
finish_value expr,
|
T.Op2(T.K.Eq, to_int @@ finish_value expr,
|
||||||
|
T.Constant(T.K.Int32, "0")),
|
||||||
finish_term tIf,
|
finish_term tIf,
|
||||||
finish_term tElse)
|
finish_term tElse)
|
||||||
| S.Swi (v, bs) ->
|
| S.Swi (v, bs) ->
|
||||||
|
|
1
src/tests/simple_if.exp
Normal file
1
src/tests/simple_if.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1
|
1
src/tests/simple_if.lambda
Normal file
1
src/tests/simple_if.lambda
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ifzero 42 then print 0 else print 1
|
Loading…
Reference in a new issue