summaryrefslogtreecommitdiff
path: root/Jennisys/Printer.fs
diff options
context:
space:
mode:
Diffstat (limited to 'Jennisys/Printer.fs')
-rw-r--r--Jennisys/Printer.fs17
1 files changed, 12 insertions, 5 deletions
diff --git a/Jennisys/Printer.fs b/Jennisys/Printer.fs
index 77e462f3..2c6315a3 100644
--- a/Jennisys/Printer.fs
+++ b/Jennisys/Printer.fs
@@ -12,7 +12,11 @@ let rec PrintSep sep f list =
let rec PrintType ty =
match ty with
- | NamedType(id) -> id
+ | IntType -> "int"
+ | BoolType -> "bool"
+ | NamedType(id) -> id
+ | SeqType(t) -> sprintf "seq[%s]" (PrintType t)
+ | SetType(t) -> sprintf "set[%s]" (PrintType t)
| InstantiatedType(id,arg) -> sprintf "%s[%s]" id (PrintType arg)
let PrintVarDecl vd =
@@ -50,11 +54,14 @@ let PrintSig signature =
else ""
sprintf "(%s)%s" (ins |> PrintSep ", " PrintVarDecl) returnClause
-let rec ForeachConjunct f expr =
+let rec SplitIntoConjunts expr =
match expr with
- | IdLiteral("true") -> ""
- | BinaryExpr(_,"&&",e0,e1) -> (ForeachConjunct f e0) + (ForeachConjunct f e1)
- | _ -> f expr
+ | IdLiteral("true") -> []
+ | BinaryExpr(_,"&&",e0,e1) -> List.concat [SplitIntoConjunts e0 ; SplitIntoConjunts e1]
+ | _ -> [expr]
+
+let rec ForeachConjunct f expr =
+ SplitIntoConjunts expr |> List.fold (fun acc e -> acc + (f e)) ""
let rec Indent i =
if i = 0 then "" else " " + (Indent (i-1))