Beispiel #1
0
# -*- coding: byfon -*-
import byfon


tp = byfon.Transpiler()

b = tp.alloc(init=1)
b2 = tp.alloc(init=0)
if! b or! b2:
    b.write()

print(tp.result)
Beispiel #2
0
# -*- coding: byfon -*-
import functools
import itertools

import byfon

tp = byfon.Transpiler(optimise_clears=False)  # Known-zero optimization breaks the program and I don't know why. This makes the output file a few KB larger, but I don't know how to fix this right now.


def read_line(most):
    if most:
        values = []
        writer = tp.alloc()
        for _ in range(most):
            val = tp.alloc().read()
            if! ~val == 10:
                byfon.write_literal(writer, "... ")
            values.append(val)
    else:
        # save allocating `writer`
        values = []
    temp = tp.alloc(init=1)
    while! temp:
        temp.read()
        temp -= ord("\n")
    temp.free()
    return values

def gen_random(state):
    state <- (state * 105) + 17
    return state