tests
[mTask.git] / mTaskInterpret.icl
1 implementation module mTaskInterpret
2
3 //import iTasks
4 import gdynamic, gCons, GenEq, StdMisc, StdArray
5 import GenPrint
6 import mTask
7
8 from StdFunc import o
9 import StdTuple
10 import Data.Tuple
11 import Control.Monad
12 import Control.Monad.State
13 from Data.Func import $
14
15
16 toByteVal :: BC -> String
17 toByteVal a = undef
18
19 derive gPrint BC
20
21 toReadableByteVal :: BC -> String
22 toReadableByteVal a = printToString a
23
24 //:: ByteCode a p = BC (BCState -> ([BC], BCState))
25 instance arith ByteCode where
26 lit a = BC \_ s->([BCPush $ toCode a], s)
27 (+.) _ _ = undef
28 (-.) _ _ = undef
29 (*.) _ _ = undef
30 (/.) _ _ = undef
31
32 instance serial ByteCode where
33 serialAvailable = undef
34 serialPrint _ = undef
35 serialPrintln _ = undef
36 serialRead = undef
37 serialParseInt = undef
38
39 instance zero BCState where
40 zero = {a=()}
41
42 runByteCode :: (ByteCode Int Expr) BCState -> [BC]
43 runByteCode (BC f) s = fst (f Rd s)
44
45 //Start :: Main (ByteCode Int Expr)
46 Start :: [BC]
47 //Start :: ByteCode Int Expr
48 Start = runByteCode (lit 36) zero