vocabulary - ponyatov/orth GitHub Wiki

Vocabulary

works as an associative array: binds a string:name to piece of code or variable value

# In Python it can be natively represented as a dictionary with string keys.
W = {}

To display vocabulary we define function can be considered as VM command, and bind name to this function into vocabulary:

def WORDS(): print W
W['WORDS'] = WORDS

To test it run WORDS() at end of VM program you do:

WORDS()

looks not too good but is acceptable for a start

{'??': <function qq at 0xb74c0fb4>, 'INTERPRET': <function INTERPRET at 0xb744ab1c>, 'WORDS': <function WORDS at 0xb74c0c34>, '?': <function q at 0xb74c0a3c>}