Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let getTypeOf argument = match argument with
- | (Variable(_) | Anonymous) -> Any
- | Set(_) -> Set
- | Integer(_) -> Int
- | String(_) -> String
- | Identifier(_) -> Identifier;;
- (* just need to verify the parameters, really. *)
- let rec verifyPredArgs args =
- let verifyPredArg arg = match arg with Argument(ty, var) ->
- (let varType = getTypeOf var in
- (match ty with
- | "Set" -> (match varType with
- | (Any | Set) -> true
- | _ as errType -> false)
- | "Int" -> (match varType with
- | (Any | Int) -> true
- | _ as errType -> false)
- | "String" -> (match varType with
- | (Any | String) -> true
- | _ as errType -> false)
- | _ as errType -> (* error! *) false
- )
- )
- in
- match args with
- | SingleArgument(ar) -> verifyPredArg ar
- | AnotherArgument(ar, more) -> verifyPredArg ar ; verifyPredArgs more;;
Advertisement
Add Comment
Please, Sign In to add comment