X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mTaskInterpret.dcl;h=0939ab45a7c1b15cf042ffdeb2a5e4faf4ce0a8c;hb=73d6866bdbab8f393b53c9951b05b62005a5423a;hp=557225f55d5d48579debbd260ab62ccd97de8725;hpb=34dfa724f02cd36ff31057ab71ba53ad57fabcb5;p=mTask.git diff --git a/mTaskInterpret.dcl b/mTaskInterpret.dcl index 557225f..0939ab4 100644 --- a/mTaskInterpret.dcl +++ b/mTaskInterpret.dcl @@ -1,26 +1,66 @@ definition module mTaskInterpret +from Data.Functor.Identity import :: Identity +from Control.Monad.State import :: State, :: StateT import mTask :: BC = BCNop | BCPush Int | BCPop + //SDS functions + | BCSdsStore Int + | BCSdsFetch Int + | BCSdsPublish Int //Unary ops - | BCNeg | BCNot //Binary Int ops | BCAdd | BCSub | BCMul | BCDiv + //Binary Bool ops + | BCAnd + | BCOr + | BCEq + | BCNeq + | BCLes + | BCGre + | BCLeq + | BCGeq + //Conditionals and jumping + | BCJmp Int + | BCJmpT Int + | BCJmpF Int + //Serial + | BCSerialAvail + | BCSerialPrint + | BCSerialPrintln + | BCSerialRead + | BCSerialParseInt + //Pins + | BCAnalogRead Pin + | BCAnalogWrite Pin + | BCDigitalRead Pin + | BCDigitalWrite Pin + | BCTest AnalogPin -:: ByteCode a p = BC ((ReadWrite a) BCState -> ([BC], BCState)) +//:: ByteCode a p = BC (BCState -> ([BC], BCState)) +:: ByteCode a p = BC [BC] +//:: ByteCode a p = BC ((ReadWrite (ByteCode a Expr)) BCState -> ([BC], BCState)) :: BCState = { a::() } -toByteVal :: BC -> String +class toByteCode a :: a -> [Char] +instance toByteCode Int +instance toByteCode Bool +instance toByteCode Char +instance toByteCode String +instance toByteCode Long +instance toByteCode Button + +toByteVal :: BC -> [Char] toReadableByteVal :: BC -> String //instance toCode Pin