Commit 07584f19 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

--- ChangeLog Thu, 08 Jan 2004 14:42:41 +0100 noe (mipsy/2_ChangeLog 1.53 604)
+++ ChangeLog Thu, 08 Jan 2004 15:24:49 +0100 noe (mipsy/2_ChangeLog 1.53 604)
@@ -1,5 +1,11 @@
 2004-01-08  Benoît Perrot  <benoit@lrde.epita.fr>
 
+       * dev/parse-asm-scan.py: Simplify scanner register generation.
+       * dev/mipsy.py: Remove useless accessors. Use a '__str__' method 
+       instead of 'display'.
+
parent 294ffa2c
2004-01-08 Benot Perrot <benoit@lrde.epita.fr>
* dev/parse-asm-scan.py: Simplify scanner register generation.
* dev/mipsy.py: Remove useless accessors. Use a '__str__' method
instead of 'display'.
2004-01-08 Benot Perrot <benoit@lrde.epita.fr> 2004-01-08 Benot Perrot <benoit@lrde.epita.fr>
* dev/mipsy-parser-gen.py: Move to... * dev/mipsy-parser-gen.py: Move to...
......
...@@ -107,15 +107,7 @@ class ParamBuilder: ...@@ -107,15 +107,7 @@ class ParamBuilder:
self.default = "" self.default = ""
def __init__(self): def __init__(self):
self.reset() self.reset()
def set_kind(self, kind):
self.kind = kind
def set_name(self, name):
self.name = name
def set_value(self, value):
self.value = value
def set_default(self, default):
self.default = default
def get(self): def get(self):
return Param(self.kind, self.name, self.value, self.default) return Param(self.kind, self.name, self.value, self.default)
...@@ -134,8 +126,6 @@ class FormatBuilder: ...@@ -134,8 +126,6 @@ class FormatBuilder:
def __init__(self): def __init__(self):
self.reset() self.reset()
def add_param(self, param):
self.params.append(param)
def get(self): def get(self):
return Format(self.params) return Format(self.params)
...@@ -159,12 +149,6 @@ class SyntaxBuilder: ...@@ -159,12 +149,6 @@ class SyntaxBuilder:
def __init__(self): def __init__(self):
self.reset() self.reset()
def set_alias(self, alias):
self.alias = alias
def set_level(self, level):
self.level = level
def add_param(self, param):
self.params.append(param)
def get(self): def get(self):
return Syntax(self.params, self.alias, self.level) return Syntax(self.params, self.alias, self.level)
...@@ -196,16 +180,6 @@ class InstructionBuilder: ...@@ -196,16 +180,6 @@ class InstructionBuilder:
def __init__(self): def __init__(self):
self.reset() self.reset()
def set_opcode(self, opcode):
self.opcode = opcode
def set_level(self, level):
self.level = level
def set_kind(self, kind):
self.kind = kind
def set_format(self, format):
self.format = format
def add_syntax(self, syntax):
self.syntaxes.append(syntax)
def get(self): def get(self):
return Instruction(self.opcode, self.level, self.kind, return Instruction(self.opcode, self.level, self.kind,
self.format, self.syntaxes) self.format, self.syntaxes)
...@@ -222,39 +196,39 @@ class InstructionSetHandler(ContentHandler): ...@@ -222,39 +196,39 @@ class InstructionSetHandler(ContentHandler):
def startElement(self, name, attrs): def startElement(self, name, attrs):
if name == "instruction": if name == "instruction":
self.ib.reset() self.ib.reset()
self.ib.set_opcode(attrs["opcode"]) self.ib.opcode = attrs["opcode"]
self.ib.set_level(attrs["level"]) self.ib.level = attrs["level"]
self.ib.set_kind(attrs["kind"]) self.ib.kind = attrs["kind"]
elif name == "format": elif name == "format":
self.fb = FormatBuilder() self.fb = FormatBuilder()
elif name == "syntax": elif name == "syntax":
self.sb.reset() self.sb.reset()
if attrs.has_key("alias"): if attrs.has_key("alias"):
self.sb.set_alias(attrs["alias"]) self.sb.alias = attrs["alias"]
if attrs.has_key("level"): if attrs.has_key("level"):
self.sb.set_level(attrs["level"]) self.sb.level = attrs["level"]
else: else:
self.sb.set_level(self.ib.level) self.sb.level = self.ib.level
elif name in ["register", "immediate", "label", "address", "hidden"]: elif name in ["register", "immediate", "label", "address", "hidden"]:
self.pb.reset() self.pb.reset()
self.pb.set_kind(name) self.pb.kind = name
if attrs.has_key("name"): if attrs.has_key("name"):
self.pb.set_name(attrs["name"]) self.pb.name = attrs["name"]
if attrs.has_key("default"): if attrs.has_key("default"):
self.pb.set_default(attrs["default"]) self.pb.default = attrs["default"]
if attrs.has_key("value"): if attrs.has_key("value"):
self.pb.set_value(attrs["value"]) self.pb.value = attrs["value"]
def endElement(self, name): def endElement(self, name):
if name in ["register", "immediate", "label", "address", "hidden"]: if name in ["register", "immediate", "label", "address", "hidden"]:
if self.fb != None: if self.fb != None:
self.fb.add_param(self.pb.get()) self.fb.params.append(self.pb.get())
else: else:
self.sb.add_param(self.pb.get()) self.sb.params.append(self.pb.get())
elif name == "syntax": elif name == "syntax":
self.ib.add_syntax(self.sb.get()) self.ib.syntaxes.append(self.sb.get())
elif name == "format": elif name == "format":
self.ib.set_format(self.fb.get()) self.ib.format = self.fb.get()
self.fb = None self.fb = None
elif name == "instruction": elif name == "instruction":
self.instructions.append(self.ib.get()) self.instructions.append(self.ib.get())
......
...@@ -107,22 +107,13 @@ print """ ...@@ -107,22 +107,13 @@ print """
yylval->reg = new Register(Register::general, Cpu::zero); yylval->reg = new Register(Register::general, Cpu::zero);
return REGISTER; return REGISTER;
}""" }"""
for i in range(2): for k, r in [("v", range(2)), ("a", range(4)),
print "\"$v" + str(i) + "\" {" ("t", range(10)), ("s", range(8))]:
print " yylval->reg = new Register(Register::general, Cpu::v" + str(i)+ ");" for i in r:
print " return REGISTER;\n}" print "\"$" + k + str(i) + "\" {"
for i in range(4): print " yylval->reg = new Register(Register::general, " + \
print "\"$a" + str(i) + "\" {" "Cpu::" + k + str(i)+ ");"
print " yylval->reg = new Register(Register::general, Cpu::a" + str(i)+ ");" print " return REGISTER;\n}"
print " return REGISTER;\n}"
for i in range(10):
print "\"$t" + str(i) + "\" {"
print " yylval->reg = new Register(Register::general, Cpu::t" + str(i)+ ");"
print " return REGISTER;\n}"
for i in range(8):
print "\"$s" + str(i) + "\" {"
print " yylval->reg = new Register(Register::general, Cpu::s" + str(i)+ ");"
print " return REGISTER;\n}"
print """ print """
\"$sp\" { \"$sp\" {
yylval->reg = new Register(Register::general, Cpu::sp); yylval->reg = new Register(Register::general, Cpu::sp);
......
...@@ -2,35 +2,25 @@ ...@@ -2,35 +2,25 @@
(Created-By-Prcs-Version 1 3 2) (Created-By-Prcs-Version 1 3 2)
(Project-Description "") (Project-Description "")
(Project-Version mipsy 0 59) (Project-Version mipsy 0 60)
(Parent-Version mipsy 0 58) (Parent-Version mipsy 0 59)
(Version-Log (Version-Log
"Index: ChangeLog "Index: ChangeLog
--- ChangeLog Tue, 06 Jan 2004 18:57:53 +0100 noe (mipsy/2_ChangeLog 1.52 604) --- ChangeLog Thu, 08 Jan 2004 14:42:41 +0100 noe (mipsy/2_ChangeLog 1.53 604)
+++ ChangeLog Thu, 08 Jan 2004 14:39:59 +0100 noe (mipsy/2_ChangeLog 1.52 604) +++ ChangeLog Thu, 08 Jan 2004 15:24:49 +0100 noe (mipsy/2_ChangeLog 1.53 604)
@@ -1,3 +1,19 @@ @@ -1,5 +1,11 @@
+2004-01-08 Benot Perrot <benoit@lrde.epita.fr> 2004-01-08 Benot Perrot <benoit@lrde.epita.fr>
+
+ * dev/mipsy-parser-gen.py: Move to... + * dev/parse-asm-scan.py: Simplify scanner register generation.
+ * dev/parse-asm-parse-gen.py: ... this file. + * dev/mipsy.py: Remove useless accessors. Use a '__str__' method
+ * dev/mipsy-scanner-gen.py: Move to... + instead of 'display'.
+ * dev/parse-asm-scan-gen.py: ... this file.
+ * src/parse/Makefile.am: Use new files' names.
+
+ * dev/mipsy-builder-gen.py: Move to...
+ * dev/inst-builder-gen.py: ... this file.
+ * dev/mipsy-inst-gen.py: Move to...
+ * dev/inst-nodes-gen.py: ... this file.
+ * dev/mipsy-mk-inst-gen.py: Move to...
+ * dev/inst-makefile-gen.py: ... this file. Use new files' names.
+ * bootstrap, Makefile.am: Use new files' names.
+ +
") ")
(New-Version-Log (New-Version-Log
"") "")
(Checkin-Time "Thu, 08 Jan 2004 14:42:41 +0100") (Checkin-Time "Thu, 08 Jan 2004 15:27:18 +0100")
(Checkin-Login noe) (Checkin-Login noe)
(Files (Files
...@@ -38,7 +28,7 @@ ...@@ -38,7 +28,7 @@
;; ./ ;; ./
(AUTHORS (mipsy/0_AUTHORS 1.1 604)) (AUTHORS (mipsy/0_AUTHORS 1.1 604))
(COPYING (mipsy/1_COPYING 1.1 604)) (COPYING (mipsy/1_COPYING 1.1 604))
(ChangeLog (mipsy/2_ChangeLog 1.53 604)) (ChangeLog (mipsy/2_ChangeLog 1.54 604))
(Makefile.am (mipsy/3_Makefile.a 1.7 604)) (Makefile.am (mipsy/3_Makefile.a 1.7 604))
(NEWS (mipsy/b/25_NEWS 1.5 604)) (NEWS (mipsy/b/25_NEWS 1.5 604))
(README (mipsy/4_README 1.2 604)) (README (mipsy/4_README 1.2 604))
...@@ -54,10 +44,10 @@ ...@@ -54,10 +44,10 @@
(dev/inst-builder-gen.py (mipsy/15_mipsy-buil 1.6 705)) (dev/inst-builder-gen.py (mipsy/15_mipsy-buil 1.6 705))
(dev/inst-makefile-gen.py (mipsy/b/15_mipsy-mk-i 1.4 705)) (dev/inst-makefile-gen.py (mipsy/b/15_mipsy-mk-i 1.4 705))
(dev/inst-nodes-gen.py (mipsy/12_mipsy-inst 1.3 705)) (dev/inst-nodes-gen.py (mipsy/12_mipsy-inst 1.3 705))
(dev/mipsy.py (mipsy/16_mipsy.py 1.5 604)) (dev/mipsy.py (mipsy/16_mipsy.py 1.6 604))
(dev/mipsy.xml (mipsy/17_mipsy.xml 1.11 604)) (dev/mipsy.xml (mipsy/17_mipsy.xml 1.11 604))
(dev/parse-asm-parse-gen.py (mipsy/13_mipsy-pars 1.5 705)) (dev/parse-asm-parse-gen.py (mipsy/13_mipsy-pars 1.5 705))
(dev/parse-asm-scan-gen.py (mipsy/14_mipsy-scan 1.7 705)) (dev/parse-asm-scan-gen.py (mipsy/14_mipsy-scan 1.8 705))
;; ./doc/ ;; ./doc/
(doc/Makefile.am (mipsy/b/9_Makefile.a 1.1 604)) (doc/Makefile.am (mipsy/b/9_Makefile.a 1.1 604))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment