ruby: move stall and wakeup functions to AbstractController
[gem5.git] / src / mem / slicc / parser.py
index 77ac4de56d131a26ef7739d46abb2911d6033f0d..78b842f7487722049c9a474d3e1f902f1717299f 100644 (file)
@@ -121,8 +121,6 @@ class SLICC(Grammar):
         'is_invalid' : 'IS_INVALID',
         'else' : 'ELSE',
         'return' : 'RETURN',
-        'THIS' : 'THIS',
-        'CHIP' : 'CHIP',
         'void' : 'VOID',
         'new' : 'NEW',
         'OOD' : 'OOD',
@@ -317,14 +315,23 @@ class SLICC(Grammar):
         "decl : type ident pairs SEMI"
         p[0] = ast.ObjDeclAST(self, p[1], p[2], p[3])
 
+    # Function definition and declaration
     def p_decl__func_decl(self, p):
-        """decl : void ident '(' params ')' pairs SEMI
+        "decl : func_decl"
+        p[0] = p[1]
+
+    def p_func_decl__0(self, p):
+        """func_decl :  void ident '(' params ')' pairs SEMI
                 | type ident '(' params ')' pairs SEMI"""
         p[0] = ast.FuncDeclAST(self, p[1], p[2], p[4], p[6], None)
 
     def p_decl__func_def(self, p):
-        """decl : void ident '(' params ')' pairs statements
-                | type ident '(' params ')' pairs statements"""
+        "decl : func_def"
+        p[0] = p[1]
+
+    def p_func_def__0(self, p):
+        """func_def : void ident '(' params ')' pairs statements
+            | type ident '(' params ')' pairs statements"""
         p[0] = ast.FuncDeclAST(self, p[1], p[2], p[4], p[6], p[7])
 
     # Type fields
@@ -340,6 +347,10 @@ class SLICC(Grammar):
         "type_member : type_or_void ident '(' types ')' pairs SEMI"
         p[0] = ast.TypeFieldMethodAST(self, p[1], p[2], p[4], p[6])
 
+    def p_type_method__1(self, p):
+        "type_member : type_or_void ident '(' params ')' pairs statements"
+        p[0] = ast.FuncDeclAST(self, p[1], p[2], p[4], p[6], p[7])
+
     def p_type_member__1(self, p):
         "type_member : type_or_void ident pairs SEMI"
         p[0] = ast.TypeFieldMemberAST(self, p[1], p[2], p[3], None)
@@ -619,27 +630,6 @@ class SLICC(Grammar):
         "aexpr : OOD"
         p[0] = ast.OodAST(self)
 
-    # globally access a local chip component and call a method
-    def p_expr__local_chip_method(self, p):
-        "aexpr : THIS DOT var '[' expr ']' DOT var DOT ident '(' exprs ')'"
-        p[0] = ast.LocalChipMethodAST(self, p[3], p[5], p[8], p[10], p[12])
-
-    # globally access a local chip component and access a data member
-    def p_expr__local_chip_member(self, p):
-        "aexpr : THIS DOT var '[' expr ']' DOT var DOT field"
-        p[0] = ast.LocalChipMemberAST(self, p[3], p[5], p[8], p[10])
-
-    # globally access a specified chip component and call a method
-    def p_expr__specified_chip_method(self, p):
-        "aexpr : CHIP '[' expr ']' DOT var '[' expr ']' DOT var DOT ident '(' exprs ')'"
-        p[0] = ast.SpecifiedChipMethodAST(self, p[3], p[6], p[8], p[11], p[13],
-                                          p[15])
-
-    # globally access a specified chip component and access a data member
-    def p_expr__specified_chip_member(self, p):
-        "aexpr : CHIP '[' expr ']' DOT var '[' expr ']' DOT var DOT field"
-        p[0] = ast.SpecifiedChipMemberAST(self, p[3], p[6], p[8], p[11], p[13])
-
     def p_expr__member(self, p):
         "aexpr : aexpr DOT ident"
         p[0] = ast.MemberExprAST(self, p[1], p[3])
@@ -718,7 +708,3 @@ class SLICC(Grammar):
     def p_var(self, p):
         "var : ident"
         p[0] = ast.VarExprAST(self, p[1])
-
-    def p_field(self, p):
-        "field : ident"
-        p[0] = p[1]