Exemple #1
0
def main():
    if len(sys.argv) < 2:
        print('Usage: chicken SCRIPT.CH [INPUT]', file=sys.stderr)
        return

    machina = Machine()

    script = sys.argv[1]
    if script == '-':
        machina.load_str(sys.stdin.read())
        machina.load_input('')
    else:
        machina.load_file(script)

    if len(sys.argv) >= 3:
        machina.load_input(sys.argv[2])

    print(machina.run())
Exemple #2
0
def boot(argv=sys.argv):
    m = Machine()
    m.load_file(argv[1])
    if len(argv) >= 3:
        m.load_input(argv[2])
    return m