X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=mTaskInterpret.icl;h=6c9fd52461a2d1e5c04ad990d36622d3d6b7f92a;hb=ff56601fe3bbca4a5d507de43f31de10a11dfdb5;hp=d689b5fbd3690d5049a686b76afaf5e0f0b96851;hpb=8316870cacd21b19badf032f3b8189bdd54eb1e3;p=mTask.git diff --git a/mTaskInterpret.icl b/mTaskInterpret.icl index d689b5f..6c9fd52 100644 --- a/mTaskInterpret.icl +++ b/mTaskInterpret.icl @@ -22,7 +22,6 @@ toByteVal a = undef derive gPrint BC, AnalogPin derive consIndex BC derive consName BC -derive conses BC, AnalogPin toReadableByteVal :: BC -> String toReadableByteVal a = printToString a @@ -46,12 +45,16 @@ instance boolExpr ByteCode where (>=.) x y = x <++> y <+-> [BCGeq] instance analogIO ByteCode where - analogRead p = BC [BCAnalogRead p] - analogWrite p b = b <+-> [BCAnalogWrite p] + analogRead p = BC [BCAnalogRead $ toCode p] + analogWrite p b = b <+-> [BCAnalogWrite $ toCode p] + +instance digitalIO ByteCode where + digitalRead p = BC [BCDigitalRead $ toCode p] + digitalWrite p b = b <+-> [BCDigitalWrite $ toCode p] instance If ByteCode Stmt Stmt Stmt where If b t e = BCIfStmt b t e instance If ByteCode Stmt e Stmt where If b t e = BCIfStmt b t e -//instance If ByteCode Stmt Stmt e where If b t e = BCIfStmt b t e +instance If ByteCode Stmt Stmt e where If b t e = BCIfStmt b t e instance If ByteCode x y Expr where If b t e = BCIfStmt b t e instance IF ByteCode where IF b t e = BCIfStmt b t e @@ -84,12 +87,9 @@ instance zero BCState where //Start :: ByteCode Int Expr //Start = (lit 36 +. lit 42) +. lit 84 -(<+) infixr 5 :: a b -> String | toString a & toString b -(<+) a b = toString a +++ toString b - //Run test programma en pretty print Start :: ByteCode Int Expr -Start = analogRead A0 +Start = If (lit True) (analogRead A1) (analogRead A0) //Start = If ((lit 36) ==. (lit 42)) (noOp) (noOp) //Generate header file