Interpreter.fs

 avatar
unknown
plain_text
2 years ago
544 B
3
Indexable
| Scan (farg, acc_exp, arr_exp, _, pos) ->
        let farg_ret_type = rtpFunArg farg ftab pos
        let arr  = evalExp(acc_exp, vtab, ftab)
        let nel  = evalExp(arr_exp, vtab, ftab)

        match arr with
          | ArrayVal (lst,tp1) -> (
            if farg_ret_type <> tp1 then (raise (MyError("Scan Failed in Interpreter", pos)))
            ArrayVal (List.tail (List.scan (fun x y -> evalFunArg (farg, vtab, ftab, pos, [x;y]))arr lst), tp1))
          | otherwise -> reportNonArray "scan error in interpreter" arr pos  
Editor is loading...