'THEN',
'ELSE',
'FOR',
- 'FOREQ',
'TO',
'DO',
'WHILE',
return t
t_COLON = r':'
-t_EQ = r'=='
+t_EQ = r'='
t_ASSIGN = r'<-'
-t_FOREQ = r'='
t_LT = r'<'
t_GT = r'>'
t_PLUS = r'\+'
p[0] = ast.Break()
def p_for_stmt(p):
- """for_stmt : FOR test FOREQ test TO test COLON suite
+ """for_stmt : FOR test EQ test TO test COLON suite
"""
p[0] = ast.While(p[2], p[4], [])
# auto-add-one (sigh) due to python range
"/": ast.Div(),
"<": make_lt_compare,
">": make_gt_compare,
- "==": make_eq_compare,
+ "=": make_eq_compare,
}
unary_ops = {
"+": ast.Add,
if p[2] == '||':
l = check_concat(p[1]) + check_concat(p[3])
p[0] = ast.Call(ast.Name("concat"), l, [])
- elif p[2] in ['<', '>', '==']:
+ elif p[2] in ['<', '>', '=']:
p[0] = binary_ops[p[2]]((p[1],p[3]))
else:
p[0] = ast.BinOp(p[1], binary_ops[p[2]], p[3])
RA <- [0]*56|| perm[0:7]
"""
-code = bpermd
+cnttzd = """
+n <- 0
+do while n < 64
+ if (RS)[63-n] = 0b1 then
+ leave
+ n <- n + 1
+RA <- EXTZ64(n)
+"""
+
+code = cnttzd
+#code = bpermd
lexer = IndentLexer(debug=1)
# Give the lexer some input