<- Back to the documentation index
lc2.lex(str)
lc2.parse(lexemes)
lines
attribute. Note that this step
also converts lexemes of type 'NUM' to have val
attribute equal to the value of the number, and converts
lexemes of type 'REG' to have val attribute equal to the value
of the register.
lc2.run_directives(ob)
lines
attribute, run
and remove each of the assembler directive lines. At the end
of this method, the only remaining lines will be those with
CPU instructions each of which will have an address property
which gives its calculated address in memory. Additionally,
any bytecode or symbols introduced by assembler directives
will appear in the bytecode
or symbols
attributes respectively.
lc2.build_symbol_table(ob)
lines
attribute
containing no assembler directives, build the symbol table
mapping symbols in the assembler source to final memory
locations and add this to the Code object as
the symbol
attribute.
lc2.translate(ob)
lines
and symbol
attributes, translate the lines to a
mapping from memory locations to bytes corresponding to the
lines of code. This method returns only the mapping from
memory locations to bytes.
lc2.assemble(str)
lc2.load_program(prg)
in lc2.js.
lines
symbols
bytecode