sp--;
break;
#endif
+ case BCRETURN: trace("Return");
+ pc = plen;
+ t = stack[sp-1];
+ break;
default:
trace("unrecognized");
die("Unrecognized command: %d", program[pc-1]);
#define BCANALOGWRITE 31
#define BCDIGITALREAD 32
#define BCDIGITALWRITE 33
-#define BCTEST 34
+#define BCRETURN 34
#endif
class seq v where
(>>=.) infixr 0 :: (v t p) ((v t Expr) -> (v u q)) -> (v u Stmt) | type t & type u
(:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | type t & type u
+class retrn v where
+ retrn :: (v t p) -> (v t Stmt) | type t
class step` v where
(>>*.) infixl 1 :: (v t p) ((v t Expr) -> [Step v u]) -> v u Stmt | type t & type u
:: Step v t = E.p.q: Cond (v Bool q) (v t p) | E.p: Ever (v t p)
| BCAnalogWrite Pin
| BCDigitalRead Pin
| BCDigitalWrite Pin
- | BCTest AnalogPin
+ //Return
+ | BCReturn
derive gPrint BCValue, MTaskDeviceSpec
derive consIndex BCValue
instance If ByteCode x y Stmt
instance IF ByteCode
instance noOp ByteCode
+instance retrn ByteCode
instance sds ByteCode
instance assign ByteCode
ledOn (BC l) = BC $ l >>| tell [BCLedOn]
ledOff (BC l) = BC $ l >>| tell [BCLedOff]
+instance retrn ByteCode where
+ retrn (BC l) = BC $ tell [BCReturn]
+
instance zero BCState where
zero = {freshl=[1..], freshs=[1..], sdss=[]}
import Data.List
from Text import class Text(join,toUpperCase), instance Text String
+derive consName BC
+derive conses BC
+
(<+) infixr 5 :: a b -> String | toString a & toString b
(<+) a b = toString a +++ toString b
delete tasks when deleting device
let tasks have a unique name
+check addition and equality for numbers and bools