mem-ruby: added %(mod) operator to SLICC
Change-Id: I9d1a10824ced3723d13e2843ad739ced72e476ce Signed-off-by: Tiago Mück <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31260 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: John Alsop <johnathan.alsop@amd.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -64,7 +64,7 @@ class InfixOperatorExprAST(ExprAST):
|
||||
elif self.op in ("<<", ">>"):
|
||||
expected_types = [("int", "int", "int"),
|
||||
("Cycles", "int", "Cycles")]
|
||||
elif self.op in ("+", "-", "*", "/"):
|
||||
elif self.op in ("+", "-", "*", "/", "%"):
|
||||
expected_types = [("int", "int", "int"),
|
||||
("Cycles", "Cycles", "Cycles"),
|
||||
("Tick", "Tick", "Tick"),
|
||||
|
||||
@@ -128,7 +128,7 @@ class SLICC(Grammar):
|
||||
tokens = [ 'EQ', 'NE', 'LT', 'GT', 'LE', 'GE',
|
||||
'LEFTSHIFT', 'RIGHTSHIFT',
|
||||
'NOT', 'AND', 'OR',
|
||||
'PLUS', 'DASH', 'STAR', 'SLASH',
|
||||
'PLUS', 'DASH', 'STAR', 'SLASH', 'MOD',
|
||||
'INCR', 'DECR',
|
||||
'DOUBLE_COLON', 'SEMI',
|
||||
'ASSIGN', 'DOT',
|
||||
@@ -150,6 +150,7 @@ class SLICC(Grammar):
|
||||
t_DASH = r'-'
|
||||
t_STAR = r'\*'
|
||||
t_SLASH = r'/'
|
||||
t_MOD = r'%'
|
||||
t_DOUBLE_COLON = r'::'
|
||||
t_SEMI = r';'
|
||||
t_ASSIGN = r':='
|
||||
@@ -165,7 +166,7 @@ class SLICC(Grammar):
|
||||
('left', 'LT', 'GT', 'LE', 'GE'),
|
||||
('left', 'RIGHTSHIFT', 'LEFTSHIFT'),
|
||||
('left', 'PLUS', 'DASH'),
|
||||
('left', 'STAR', 'SLASH'),
|
||||
('left', 'STAR', 'SLASH', 'MOD'),
|
||||
('right', 'NOT', 'UMINUS'),
|
||||
)
|
||||
|
||||
@@ -695,6 +696,7 @@ class SLICC(Grammar):
|
||||
def p_expr__binary_op(self, p):
|
||||
"""expr : expr STAR expr
|
||||
| expr SLASH expr
|
||||
| expr MOD expr
|
||||
| expr PLUS expr
|
||||
| expr DASH expr
|
||||
| expr LT expr
|
||||
|
||||
Reference in New Issue
Block a user