23 binary_bitwise_ops
= {
29 # todo: add shift operations
50 number_types
= dict(int_types
.items() + float_types
.item())
52 def binary_exp(folder
, type1
, val1
, type2
, val2
, op
):
53 filename
= folder
+ '/' + name
+ '-' + type1
+ '-' + type2
+ '.mgw'
54 content
= "void main()\n" + "{\n" + \
55 " cast(" + type1
+ ", " + val1
+ ") " + op
+ \
56 " cast(" + type2
+ ", " + val2
+ ");\n}\n"
57 file = open(filename
, "w")
61 for symbol
, name
in binary_ops
.iteritems():
62 for type1
, val1
in number_types
.iteritems():
63 for type2
, val2
in number_types
.iteritems():
64 binary_exp('expr', type1
, val1
, type2
, val2
, op
)
66 for symbol
, name
in binary_bitwise_ops
.iteritems():
67 for type1
, val1
in int_types
.iteritems():
68 for type2
, val2
in int_types
.iteritems():
69 binary_exp('expr', type1
, val1
, type2
, val2
, op
)
71 for symbol
, name
in binary_bitwise_ops
.iteritems():
72 for type1
, val1
in float_types
.iteritems():
73 for type2
, val2
in number_types
.iteritems():
74 binary_exp('bad_expr', type1
, val1
, type2
, val2
, op
)