summaryrefslogtreecommitdiff
path: root/Language
diff options
context:
space:
mode:
Diffstat (limited to 'Language')
-rw-r--r--Language/C.hs3
-rw-r--r--Language/C/Print.hs4
2 files changed, 5 insertions, 2 deletions
diff --git a/Language/C.hs b/Language/C.hs
index 35cf432..6a3256f 100644
--- a/Language/C.hs
+++ b/Language/C.hs
@@ -9,6 +9,7 @@ data FunDef
| ProcDef Name [(Type, Name)] [Stmt]
deriving (Show, Eq)
+-- | Some C types.
data Type
= TInt Bits
| TUInt Bits
@@ -17,9 +18,11 @@ data Type
| TPtr Type
deriving (Show, Eq)
+-- | The number of bits in a C integral type.
data Bits = B8 | B16 | B32 | B64
deriving (Show, Eq)
+-- | A C variable or function name.
newtype Name = Name String
deriving (Show, Eq, Ord)
diff --git a/Language/C/Print.hs b/Language/C/Print.hs
index e075b0e..cc511b2 100644
--- a/Language/C/Print.hs
+++ b/Language/C/Print.hs
@@ -20,12 +20,12 @@ printFunDef (FunDef rt n as (StExpr ss rete)) =
% intercalates ", " [printType t % printString " " % printName an | (t, an) <- as]
% printString ") {\n "
% addIndent 2 (intercalates "\n" (map printStmt ss))
- % printString "\n return (" % printExpr rete % printString ");\n}"
+ % printString "\n return (" % printExpr rete % printString ");\n}\n"
printFunDef (ProcDef n as ss) =
printString "void " % printName n
% printString "("
% intercalates ", " [printType t % printString " " % printName an | (t, an) <- as]
- % printString ") " % printBlock ss
+ % printString ") " % printBlock ss % printString "\n"
printName :: Name -> PrintS
printName (Name s) = printString s