git @ Cat's Eye Technologies Falderal / master tests / silly-interpreter.py
master

Tree @master (Download .tar.gz)

silly-interpreter.py @masterraw · history · blame

# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense

import sys

program = open(sys.argv[1]).read().split('\n')

vars = {}
for line in program:
    if line.startswith('print '):
        var = line[6]
        print(vars.get(var, ''))
    if line.startswith('read '):
        var = line[5]
        vars[var] = input('')