summaryrefslogtreecommitdiff
path: root/frontend/ast_printer.ml
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/ast_printer.ml')
-rw-r--r--frontend/ast_printer.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/frontend/ast_printer.ml b/frontend/ast_printer.ml
index 3ac881e..7ddcb67 100644
--- a/frontend/ast_printer.ml
+++ b/frontend/ast_printer.ml
@@ -1,5 +1,6 @@
open Ast
open Lexing
+open Typing
(* Locations *)
@@ -252,3 +253,14 @@ let print_toplevel fmt = function
let print_prog fmt p =
List.iter (print_toplevel fmt) p
+
+
+(* Typed variable *)
+
+let print_type fmt = function
+ | TInt -> Format.fprintf fmt "int"
+ | TReal -> Format.fprintf fmt "real"
+ | TEnum e -> Format.fprintf fmt "enum { %a }" (print_list print_id ", ") e
+
+let print_typed_var fmt (p, id, t) =
+ Format.fprintf fmt "%s%s: %a" (if p then "probe " else "") id print_type t