diff options
Diffstat (limited to 'assignment-13/uFPL/C.icl')
-rw-r--r-- | assignment-13/uFPL/C.icl | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/assignment-13/uFPL/C.icl b/assignment-13/uFPL/C.icl index 87f8573..61e572e 100644 --- a/assignment-13/uFPL/C.icl +++ b/assignment-13/uFPL/C.icl @@ -12,7 +12,6 @@ import Data.List import Data.Maybe import Data.Tuple -import uFPL.Arduino import uFPL.Util (`seq`) infixr 0 :: CBody CBody -> CBody @@ -26,7 +25,7 @@ gDefault{|Bool|} = False gDefault{|Char|} = '\x00' gDefault{|Maybe|} _ = Nothing -derive gDefault Button, Signedness, CType, CExpr, CBody, CFun +derive gDefault Signedness, CType, CExpr, CBody, CFun instance print Signedness where @@ -40,25 +39,19 @@ where print (CTInt s) = print s o print " int" print (CTLong s) = print s o print " long" print CTVoid = print "void" - print (CTArray t) = print "*" o print t print (CTStruct s) = print "struct " o print s -instance print (Int,CType) // Variable -where - print (i,t) = print t o print " v" o print i - instance print CExpr where - print (CEButton b) = print b print (CEGlobal g) = print g print (CEInfix op a b) = print "(" o print a o print ") " o print op o print " (" o print b o print ")" print (CEApp f ps) = print f o print "(" o prsperse ", " ps o print ")" print (CEBool b) = print (if b "true" "false") print (CEInt i) = print i print (CEChar c) = print "'" o print (toString c) o print "'" + print (CEString s) = print "\"" o print s o print "\"" print (CEIf b t e) = print "(" o print b o print " ? " o print t o print " : " o print e o print ")" print (CERef e) = print "&(" o print e o print ")" - print (CEDeref e) = print "*(" o print e o print ")" print (CEStruct m) = print "{" o indent o nl o prsperse (print "," o nl) (map pr m) o unindent o nl o print "}" where pr :: (String, CExpr) -> String @@ -76,7 +69,6 @@ where o print e o unindent o nl o print "}" Nothing -> print "}" - print (CBWhile e b) = print "while (" o print e o print ") {" o nl o print b o nl o print "}" print (CBAssign v e) = print v o print " = " o print e o print ";" print (CBSeq a b) = print a o nl o print b print CBEmpty = id @@ -89,7 +81,7 @@ where instance print CFun where print cf = print cf.CFun.type o print " " o print cf.CFun.name - o print "(" o prsperse ", " cf.params o print ") {" o indent o nl + o print "() {" o indent o nl o print cf.body o unindent o nl o print "}" instance print CProg |