implementation module mTaskInterpret
-import iTasks
+//import iTasks
import gdynamic, gCons, GenEq, StdMisc, StdArray
import GenPrint
import mTask
+from StdFunc import o
+import StdTuple
+import Data.Tuple
+import Control.Monad
+import Control.Monad.State
+from Data.Func import $
+
toByteVal :: BC -> String
toByteVal a = undef
toReadableByteVal :: BC -> String
toReadableByteVal a = printToString a
+//:: ByteCode a p = BC (BCState -> ([BC], BCState))
instance arith ByteCode where
- lit _ = undef
- (+.) _ _ = undef
- (-.) _ _ = undef
- (*.) _ _ = undef
- (/.) _ _ = undef
+ lit a = BC \_ s->([BCPush $ toCode a], s)
+ (+.) _ _ = undef
+ (-.) _ _ = undef
+ (*.) _ _ = undef
+ (/.) _ _ = undef
instance serial ByteCode where
- serialAvailable = undef
- serialPrint _ = undef
- serialPrintln _ = undef
- serialRead = undef
- serialParseInt = undef
-
-Start :: Main (ByteCode Int Expr)
-Start = {main=serialPrint (lit 36)}
+ serialAvailable = undef
+ serialPrint _ = undef
+ serialPrintln _ = undef
+ serialRead = undef
+ serialParseInt = undef
+
+instance zero BCState where
+ zero = {a=()}
+
+runByteCode :: (ByteCode Int Expr) BCState -> [BC]
+runByteCode (BC f) s = fst (f Rd s)
+
+//Start :: Main (ByteCode Int Expr)
+Start :: [BC]
+//Start :: ByteCode Int Expr
+Start = runByteCode (lit 36) zero