Beispiel #1
0
        Set [X A] ((100 * A) / X)
    }
}
"""

arithmetic_test_string = """
Set A (5 + 4 * 9)
"""

tokenizer = DBNTokenizer()
parser = DBNParser()

tokens = tokenizer.tokenize(repeat_test)

for token in tokens:
    print token
dbn_ast = parser.parse(tokens)

dbn_ast.pprint()

state = DBNInterpreterState()
first_state = state
state = dbn_ast.apply(state)
output.draw_window(state.image._image)






Beispiel #2
0
    JAVASCRIPT = options.javascript

    try:
        filename = args[0]
        dbn_script = open(filename).read()

        state = run_script_text(dbn_script,
                                verbose=VERBOSE,
                                javascript=JAVASCRIPT)
        first = state
        while first.previous is not None:
            first = first.previous
    except IndexError:
        dbn_script = ''
        state = DBNInterpreterState()
        first = 5

    if options.animate:
        output.animate_state(first, 'next')
    elif options.line_numbers:
        output.print_line_numbers(first)
    elif options.full:
        # we have to destroy local references to this huge ass state.
        # first save it in a container
        states = [state]
        del state
        del first
        output.full_interface(states, dbn_script)
    elif not JAVASCRIPT:
        output.draw_window(state.image._image, time=options.time)
Beispiel #3
0
    VERBOSE = options.verbose
    JAVASCRIPT = options.javascript

    try:
        filename = args[0]
        dbn_script = open(filename).read()
        
        state = run_script_text(dbn_script, verbose=VERBOSE, javascript=JAVASCRIPT)
        first = state
        while first.previous is not None:
            first = first.previous
    except IndexError:
        dbn_script = ''
        state = DBNInterpreterState()
        first = 5

    if options.animate: 
        output.animate_state(first, 'next')
    elif options.line_numbers:
        output.print_line_numbers(first)
    elif options.full:
        # we have to destroy local references to this huge ass state.
        # first save it in a container
        states = [state]
        del state
        del first
        output.full_interface(states, dbn_script)
    elif not JAVASCRIPT:
        output.draw_window(state.image._image, time=options.time)