Add initial typechecker for AST #2
@ -324,7 +324,7 @@ checkBitwiseOperation :: BinaryOperator -> Expression -> Expression -> DataType
|
|||||||
checkBitwiseOperation op expr1' expr2' type1 type2
|
checkBitwiseOperation op expr1' expr2' type1 type2
|
||||||
| type1 == "int" && type2 == "int" =
|
| type1 == "int" && type2 == "int" =
|
||||||
TypedExpression "int" (BinaryOperation op expr1' expr2')
|
TypedExpression "int" (BinaryOperation op expr1' expr2')
|
||||||
| otherwise = error $ "Bitwise operation " ++ show op ++ " requires operands of type int"
|
| otherwise = error $ "Bitwise operation " ++ show op ++ " requires operands of type int or char"
|
||||||
|
|
||||||
checkComparisonOperation :: BinaryOperator -> Expression -> Expression -> DataType -> DataType -> Expression
|
checkComparisonOperation :: BinaryOperator -> Expression -> Expression -> DataType -> DataType -> Expression
|
||||||
checkComparisonOperation op expr1' expr2' type1 type2
|
checkComparisonOperation op expr1' expr2' type1 type2
|
||||||
|
Loading…
Reference in New Issue
Block a user