From 0a67b804bbcae68482a3479b23acc133ede7952e Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 7 Apr 2009 16:01:44 +0000 Subject: [PATCH] Added more intrinsically-defined operators to the list --- common/Intrinsics.hs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/common/Intrinsics.hs b/common/Intrinsics.hs index 809b2b7..e008f8d 100644 --- a/common/Intrinsics.hs +++ b/common/Intrinsics.hs @@ -20,6 +20,7 @@ with this program. If not, see . module Intrinsics where import Data.Char +import Data.List import qualified AST as A @@ -171,28 +172,41 @@ rainIntrinsicFunctions = , ("fromNanos", ([A.Time], [(A.Int64, "value")])) ] +-- I think several of these operators are defined where they shouldn't be.. occamIntrinsicOperators :: [(String, A.Type, [A.Type])] occamIntrinsicOperators = concat [comparison ">" ,comparison ">=" ,comparison "<" ,comparison "<=" + ,comparison "AFTER" ,arithmetic "+" ,arithmetic "-" ,arithmetic "*" ,arithmetic "/" ,arithmetic "\\" ,arithmetic "REM" + ,arithmetic "PLUS" + ,arithmetic "TIMES" + ,arithmetic "MINUS" ,equalityOp "=" ,equalityOp "<>" - ,unaryArith "-" + ,unaryArith "-" -- \\ [("-",A.Byte,[A.Byte])] ,bitwiseOpr "/\\" ,bitwiseOpr "\\/" ,bitwiseOpr "><" ,shiftingOp ">>" ,shiftingOp "<<" + ,booleanOpr "AND" + ,booleanOpr "OR" + ,[("NOT", A.Bool, [A.Bool])] + ,[("~", t, [t]) | t <- allIntegerTypes] + ,[("MINUS", t, [t]) | t <- allNumericTypes] ] where + booleanOpr :: String -> [(String, A.Type, [A.Type])] + booleanOpr op = [(op, A.Bool, [A.Bool, A.Bool])] + comparison :: String -> [(String, A.Type, [A.Type])] comparison op = [(op, A.Bool, [t, t]) | t <- allNumericTypes]