derive gPrint BC, AnalogPin
derive consIndex BC
derive consName BC
-derive conses BC, AnalogPin
toReadableByteVal :: BC -> String
toReadableByteVal a = printToString a
(>=.) 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
//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