Implemented interpreter, almost fully documented

This commit is contained in:
hellerve
2015-07-08 16:38:49 +02:00
parent a96a5fe1f7
commit 9d4406907a
6 changed files with 137 additions and 22 deletions

View File

@@ -26,7 +26,8 @@ def lex(characters, token_exprs):
tokens.append(token)
break
if not match:
sys.stderr.write('[Parser] Illegal character: %s\\n' % characters[pos])
sys.stderr.write('[Lexer] Illegal character at %d: %s(%d)\n'
% (pos, characters[pos], ord(characters[pos])))
raise ValueError(characters[pos])
else:
pos = match.end(0)