def eval(source, optimize=True, output=sys.stdout, input=sys.stdin, steps=-1):
    """Compiles and runs program, returning the values on the stack.

    To return the machine instead, see execute().

    Args:
        optimize: Whether to optimize the code after parsing it.
        output: Stream which program can write output to.
        input: Stream which program can read input from.
        steps: An optional maximum number of instructions to execute on the
            virtual machine.  Set to -1 for no limit.

    Returns:
        None: If the stack is empty
        obj: If the stack contains a single value
        [obj, obj, ...]: If the stack contains many values
    """
    machine = execute(source, optimize=optimize, output=output, input=input,
            steps=steps)
    ds = machine.stack

    if len(ds) == 0:
        return None
    elif len(ds) == 1:
        return ds[-1]
    else:
        return ds
Compiles and runs program, returning the values on the stack.

    To return the machine instead, see execute().

    Args:
        optimize: Whether to optimize the code after parsing it.
        output: Stream which program can write output to.
        input: Stream which program can read input from.
        steps: An optional maximum number of instructions to execute on the
            virtual machine.  Set to -1 for no limit.

    Returns:
        None: If the stack is empty
        obj: If the stack contains a single value
        [obj, obj, ...]: If the stack contains many values