Added more intrinsically-defined operators to the list
This commit is contained in:
parent
a8c9802f5d
commit
0a67b804bb
|
@ -20,6 +20,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
module Intrinsics where
|
module Intrinsics where
|
||||||
|
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
import Data.List
|
||||||
|
|
||||||
import qualified AST as A
|
import qualified AST as A
|
||||||
|
|
||||||
|
@ -171,28 +172,41 @@ rainIntrinsicFunctions =
|
||||||
, ("fromNanos", ([A.Time], [(A.Int64, "value")]))
|
, ("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 :: [(String, A.Type, [A.Type])]
|
||||||
occamIntrinsicOperators = concat
|
occamIntrinsicOperators = concat
|
||||||
[comparison ">"
|
[comparison ">"
|
||||||
,comparison ">="
|
,comparison ">="
|
||||||
,comparison "<"
|
,comparison "<"
|
||||||
,comparison "<="
|
,comparison "<="
|
||||||
|
,comparison "AFTER"
|
||||||
,arithmetic "+"
|
,arithmetic "+"
|
||||||
,arithmetic "-"
|
,arithmetic "-"
|
||||||
,arithmetic "*"
|
,arithmetic "*"
|
||||||
,arithmetic "/"
|
,arithmetic "/"
|
||||||
,arithmetic "\\"
|
,arithmetic "\\"
|
||||||
,arithmetic "REM"
|
,arithmetic "REM"
|
||||||
|
,arithmetic "PLUS"
|
||||||
|
,arithmetic "TIMES"
|
||||||
|
,arithmetic "MINUS"
|
||||||
,equalityOp "="
|
,equalityOp "="
|
||||||
,equalityOp "<>"
|
,equalityOp "<>"
|
||||||
,unaryArith "-"
|
,unaryArith "-" -- \\ [("-",A.Byte,[A.Byte])]
|
||||||
,bitwiseOpr "/\\"
|
,bitwiseOpr "/\\"
|
||||||
,bitwiseOpr "\\/"
|
,bitwiseOpr "\\/"
|
||||||
,bitwiseOpr "><"
|
,bitwiseOpr "><"
|
||||||
,shiftingOp ">>"
|
,shiftingOp ">>"
|
||||||
,shiftingOp "<<"
|
,shiftingOp "<<"
|
||||||
|
,booleanOpr "AND"
|
||||||
|
,booleanOpr "OR"
|
||||||
|
,[("NOT", A.Bool, [A.Bool])]
|
||||||
|
,[("~", t, [t]) | t <- allIntegerTypes]
|
||||||
|
,[("MINUS", t, [t]) | t <- allNumericTypes]
|
||||||
]
|
]
|
||||||
where
|
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 :: String -> [(String, A.Type, [A.Type])]
|
||||||
comparison op = [(op, A.Bool, [t, t])
|
comparison op = [(op, A.Bool, [t, t])
|
||||||
| t <- allNumericTypes]
|
| t <- allNumericTypes]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user