From a3177645773b8eb4b835050c395554d3e2b4664a Mon Sep 17 00:00:00 2001 From: Tony Gutierrez Date: Mon, 20 Jul 2015 09:15:18 -0500 Subject: ruby: slicc: have a static MachineType This patch is imported from reviewboard patch 2551 by Nilay. This patch moves from a dynamically defined MachineType to a statically defined one. The need for this patch was felt since a dynamically defined type prevents us from having types for which no machine definition may exist. The following changes have been made: i. each machine definition now uses a type from the MachineType enumeration instead of any random identifier. This required changing the grammar and the *.sm files. ii. MachineType enumeration defined statically in RubySlicc_Exports.sm. * * * normal protocol fixes for nilay's parser machine type fix --- src/mem/slicc/parser.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/mem/slicc/parser.py') diff --git a/src/mem/slicc/parser.py b/src/mem/slicc/parser.py index 364bb92f7..4afe0d367 100644 --- a/src/mem/slicc/parser.py +++ b/src/mem/slicc/parser.py @@ -62,7 +62,6 @@ class SLICC(Grammar): return code def process(self): - self.decl_list.findMachines() self.decl_list.generate() def writeCodeFiles(self, code_path, includes): @@ -72,10 +71,7 @@ class SLICC(Grammar): self.symtab.writeHTMLFiles(html_path) def files(self): - f = set([ - 'MachineType.cc', - 'MachineType.hh', - 'Types.hh' ]) + f = set(['Types.hh']) f |= self.decl_list.files() @@ -259,11 +255,11 @@ class SLICC(Grammar): p[0] = self.parse_file(filename) def p_decl__machine0(self, p): - "decl : MACHINE '(' ident ')' ':' obj_decls '{' decls '}'" + "decl : MACHINE '(' enumeration ')' ':' obj_decls '{' decls '}'" p[0] = ast.MachineAST(self, p[3], [], p[7], p[9]) def p_decl__machine1(self, p): - "decl : MACHINE '(' ident pairs ')' ':' obj_decls '{' decls '}'" + "decl : MACHINE '(' enumeration pairs ')' ':' obj_decls '{' decls '}'" p[0] = ast.MachineAST(self, p[3], p[4], p[7], p[9]) def p_decl__action(self, p): -- cgit v1.2.3