1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 08:27:03 +03:00
juvix/tests/positive/MiniC/BuiltinsStdlib/Input.juvix
Paul Cadman 8ef970d3fd
Add printString and printBool support to legacy C backend (#1698)
This PR implements `printString` and `printBool` builtins for the legacy
C backend. Previously IO for strings was done using compile blocks with
included C code.

Fixes https://github.com/anoma/juvix/issues/1696
2023-01-04 18:02:02 +01:00

22 lines
507 B
Plaintext

module Input;
open import Stdlib.Prelude;
open import Stdlib.Data.Nat.Ord;
mult : Nat → Nat → Nat;
mult zero _ := zero;
mult (suc n) m := m + (mult n m);
main : IO;
main := printStringLn "hello"
>> printBoolLn true
>> printBoolLn false
>> printNatLn (mult 3 (2 + 2))
>> printNatLn 2
>> printNatLn (if (1 == 2) 100 200)
>> printNatLn (if (1 == 1) 300 400)
>> if (1 == 2) (printNatLn 500) (printNatLn 600)
>> if (1 == 1) (printNatLn 700) (printNatLn 800);
end;