str term_namespace = "/dev/term/0"; str prompt = "Enter a string:"; str nl = "\n"; plex Terminal { nat handle; } /** * Main function */ function main() { str term_ns = term_namespace; int mode = 0; Terminal term = open(term_ns, mode); real a = 5.0; // do (int i = 5000; i >= 0, i = i - 1) int i = 5000; int tmp0 = 0; int tmp1 = 1; int tmp2 = 5.0; loop loop_body { a = a + tmp2; i = i - tmp1; jump_ge_int loop_body i tmp0; } nat b = a as nat; str local_prompt = prompt; pln(local_prompt); nat size = 32; str user_string = malloc(size); read(term, user_string, size); str a_str = a as str; pln(a_str); str b_str = b as str; pln(b_str); pln(user_string); } /** * Print with a newline */ function pln(str message) { str term_ns = term_namespace; int mode = 0; Terminal term = open(term_ns, mode); int msg_len = message.length; write(term, message, msg_len); str nl_local = nl; int nl_len = nl.length; write(term, nl_local, nl_len); }