python-simple-vm
python-simple-vm copied to clipboard
IndexError: Unknown token NEWLINE: ''
I guess it is caused by using mac (I'm using MacOSX High Sierra).
Hit CTRL+D or type "exit" to quit.
> 1 1 + println
IndexError: Unknown token NEWLINE: ''
Same error on 3.7.3/RPI, but does not show up when i run the program on 2.x version of python. This is what i did to fix it:
In the Paser function i added 'tokenize.NEWLINE' criteria of the break rule
elif toknum in [tokenize.ENDMARKER, tokenize.NEWLINE]: break
De divide opcode is also not correct working, this my fix for that. added int() to the division
def div(self): last = self.pop() self.push(int(self.pop() / last))