Class: Machine10

Six~ Machine10

Example 6/10: stack machine with mnemonics.


new Machine10()

Source:

Extends

Methods


Add()

stack: ... a b -> ... a+b

Source:

Divide()

stack: ... a b -> ... a/b

Source:

Input()

stack: ... -> ... input

Source:

Load()

stack: ... -> ... memory[addr]

Source:

Minus()

stack: ... a -> ... -a

Source:

Multiply()

stack: ... a b -> ... a*b

Source:

Pop()

stack: ... val -> ...

Source:

Push()

stack: ... -> ... result

Source:

Puts()

stack: ... val -> ... | puts(val)

Source:

Store()

stack: ... val -> ... val | memory[a]: val

Source:

Subtract()

stack: ... a b -> ... a-b

Source:

gen()

returns code.length

Source:

ins()

returns instruction function

Source:

run()

Creates stack machine

Inherited From:
Source:

toString()

Represents code as text

Inherited From:
Source: