Mercurial > lcfOS
comparison python/asm.py @ 315:084cccaa5deb
Added console and screen
author | Windel Bouwman |
---|---|
date | Sat, 21 Dec 2013 10:03:01 +0100 |
parents | be7f60545368 |
children | e84047f29c78 |
comparison
equal
deleted
inserted
replaced
314:38f5f298ce0e | 315:084cccaa5deb |
---|---|
56 loc = SourceLocation('', line, col, 0) | 56 loc = SourceLocation('', line, col, 0) |
57 raise CompilerError('Unexpected character {0}'.format(s[pos]), loc) | 57 raise CompilerError('Unexpected character {0}'.format(s[pos]), loc) |
58 | 58 |
59 | 59 |
60 class Lexer: | 60 class Lexer: |
61 def __init__(self, src): | 61 def __init__(self, src): |
62 self.tokens = tokenize(src) | 62 self.tokens = tokenize(src) |
63 self.curTok = self.tokens.__next__() | 63 self.curTok = self.tokens.__next__() |
64 def eat(self): | 64 |
65 t = self.curTok | 65 def eat(self): |
66 self.curTok = self.tokens.__next__() | 66 t = self.curTok |
67 return t | 67 self.curTok = self.tokens.__next__() |
68 @property | 68 return t |
69 def Peak(self): | 69 |
70 return self.curTok | 70 @property |
71 def Peak(self): | |
72 return self.curTok | |
71 | 73 |
72 | 74 |
73 class Parser: | 75 class Parser: |
74 def __init__(self): | 76 def __init__(self): |
75 # Construct a parser given a grammar: | 77 # Construct a parser given a grammar: |