diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2011-03-18 14:12:04 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2011-03-18 14:12:04 -0500 |
commit | 18142df5b9f7fa62e5a66092bb9451f920364018 (patch) | |
tree | 5081404fed6145254a5fab61cba1120e8d22ca1b /src/mem/slicc/parser.py | |
parent | 3f27ccbb5488a6904f8bffc7e2ecc58c39a09119 (diff) | |
download | gem5-18142df5b9f7fa62e5a66092bb9451f920364018.tar.xz |
SLICC: Remove external_type for structures
In SLICC, in order to define a type a data type for which it should not
generate any code, the keyword external_type is used. For those data types for
which code should be generated, the keyword structure is used. This patch
eliminates the use of keyword external_type for defining structures. structure
key word can now have an optional attribute external, which would be used for
figuring out whether or not to generate the code for this structure. Also, now
structures can have functions as well data members in them.
Diffstat (limited to 'src/mem/slicc/parser.py')
-rw-r--r-- | src/mem/slicc/parser.py | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/mem/slicc/parser.py b/src/mem/slicc/parser.py index 8095fc8b4..aeda218f7 100644 --- a/src/mem/slicc/parser.py +++ b/src/mem/slicc/parser.py @@ -309,11 +309,6 @@ class SLICC(Grammar): p[4]["external"] = "yes" p[0] = ast.TypeDeclAST(self, p[3], p[4], []) - def p_decl__extern1(self, p): - "decl : EXTERN_TYPE '(' type pairs ')' '{' type_methods '}'" - p[4]["external"] = "yes" - p[0] = ast.TypeDeclAST(self, p[3], p[4], p[7]) - def p_decl__global(self, p): "decl : GLOBAL '(' type pairs ')' '{' type_members '}'" p[4]["global"] = "yes" @@ -357,28 +352,19 @@ class SLICC(Grammar): "type_members : empty" p[0] = [] + def p_type_method__0(self, p): + "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_member__1(self, p): - "type_member : type ident pairs SEMI" + "type_member : type_or_void ident pairs SEMI" p[0] = ast.TypeFieldMemberAST(self, p[1], p[2], p[3], None) def p_type_member__2(self, p): - "type_member : type ident ASSIGN expr SEMI" + "type_member : type_or_void ident ASSIGN expr SEMI" p[0] = ast.TypeFieldMemberAST(self, p[1], p[2], ast.PairListAST(self), p[4]) - # Methods - def p_type_methods__list(self, p): - "type_methods : type_method type_methods" - p[0] = [ p[1] ] + p[2] - - def p_type_methods(self, p): - "type_methods : empty" - p[0] = [] - - def p_type_method(self, p): - "type_method : type_or_void ident '(' types ')' pairs SEMI" - p[0] = ast.TypeFieldMethodAST(self, p[1], p[2], p[4], p[6]) - # Enum fields def p_type_enums__list(self, p): "type_enums : type_enum type_enums" |