summaryrefslogtreecommitdiff
path: root/libs/util.ml
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ansys.com>2014-06-11 16:41:43 +0200
committerAlex Auvolat <alex.auvolat@ansys.com>2014-06-11 16:41:43 +0200
commit36f98d819756ada119e696729e40d8e8e427b5f0 (patch)
treecacac900a6923e68911756c335f0dfaa61fcfba5 /libs/util.ml
downloadscade-analyzer-36f98d819756ada119e696729e40d8e8e427b5f0.tar.gz
scade-analyzer-36f98d819756ada119e696729e40d8e8e427b5f0.zip
Initial commit: parser for tiny subset of SCADE language...
Diffstat (limited to 'libs/util.ml')
-rw-r--r--libs/util.ml20
1 files changed, 20 insertions, 0 deletions
diff --git a/libs/util.ml b/libs/util.ml
new file mode 100644
index 0000000..30cf5bf
--- /dev/null
+++ b/libs/util.ml
@@ -0,0 +1,20 @@
+exception TypeError
+
+module VarMap = Mapext.Make(String)
+
+let rec fix equal f s =
+ let fs = f s in
+ if equal fs s
+ then fs
+ else fix equal f fs
+
+let (@@) f x = f x
+
+let print_list x l =
+ Format.printf "%s: " x;
+ let rec aux = function
+ | [] -> ()
+ | [a] -> Format.printf "%s" a
+ | p::q -> Format.printf "%s, " p; aux q
+ in
+ Format.printf "["; aux l; Format.printf "]@.";