summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp4bl0 <r _at_ uzy .dot. me>2018-06-18 11:51:37 (CEST)
committerp4bl0 <r _at_ uzy .dot. me>2018-06-18 11:51:37 (CEST)
commitcc019994f80ca282d1ca1f1ab2857e61cc22cd92 (patch)
treee80fdccc62913fbaf121fe37634decae4772f58c
parentf14634fda1137c0be69d92aceb5c15298f85b704 (diff)
downloadseselab-cc019994f80ca282d1ca1f1ab2857e61cc22cd92.zip
seselab-cc019994f80ca282d1ca1f1ab2857e61cc22cd92.tar.gz
remove useless helper function
-rw-r--r--compiler.py17
-rw-r--r--cpu.py4
2 files changed, 7 insertions, 14 deletions
diff --git a/compiler.py b/compiler.py
index ea9c4b2..fbcc140 100644
--- a/compiler.py
+++ b/compiler.py
@@ -5,30 +5,27 @@ from exn import *
class Compiler:
def __init__ (self):
- self._linum = []
+ self._ln = []
self._files = []
self._count = 0
self._labels = {}
self._code = []
- def err (self, msg):
- raise ParseError(msg, self._files[-1], self._linum[-1])
-
def arit (self, i, a):
if len(i) != a + 1:
- self.err('arity')
+ raise ParseError('arity')
def addr (self, a, noref = False):
if a[0] == 'r':
if a[1:].isdigit():
return ('reg', int(a[1:]))
else:
- self.err('register')
+ raise ParseError('register')
if a[0] == '@':
if a[1:].isdigit():
return ('mem', int(a[1:]))
else:
- self.err('memory')
+ raise ParseError('memory')
if a[0] == '!' and not noref:
if ',' in a:
r = a[1:].split(',', 1)
@@ -36,15 +33,15 @@ class Compiler:
else:
return ('ref', self.val(a[1:], True))
if noref:
- self.err('reference')
- self.err('address')
+ raise ParseError('reference')
+ raise ParseError('address')
def val (self, v, noref = False):
if v[0] == '#':
try:
return ('imm', int(v[1:]))
except:
- self.err('immediate')
+ raise ParseError('immediate')
else:
return self.addr(v, noref)
diff --git a/cpu.py b/cpu.py
index c1d896c..da6ca1d 100644
--- a/cpu.py
+++ b/cpu.py
@@ -156,7 +156,3 @@ class CPU:
def run (self):
while self.cycle():
pass
-
- def dbg (self, ip):
- return (' on line ' + str(self._code[ip][1][1]) +
- ' of file ' + self._code[ip][1][0])
Pablo Rauzy — generated by cgit