Files compil.ml? for compilation XPath -> ASTA
authorLucca Hirschi <lucca.hirschi@gmail.com>
Mon, 2 Jul 2012 09:13:15 +0000 (11:13 +0200)
committerLucca Hirschi <lucca.hirschi@gmail.com>
Mon, 2 Jul 2012 09:13:15 +0000 (11:13 +0200)
+ test.ml call this function and print the result

src/asta.ml
src/asta.mli
src/compil.ml [new file with mode: 0644]
src/compil.mli [new file with mode: 0644]
src/test.ml

index cb4521e..670bb35 100644 (file)
@@ -13,8 +13,6 @@
 (*                                                                     *)
 (***********************************************************************)
 
-open Format
-
 type state = State.t
 
 type label = QNameSet.t
@@ -73,6 +71,14 @@ let transitions asta st =
     | (a,s,l) :: tl -> (s,l) :: (remove_states tl) in
   remove_states (SetT.elements (SetT.filter filter asta.trans))
 
+let dummy = {
+  reco = StateSet.empty;
+  selec = StateSet.empty;
+  bottom = StateSet.empty;
+  top = StateSet.empty;
+  trans = SetT.empty;
+}
+
 
 let print fmt asta =
   let pp = Format.fprintf fmt in
@@ -85,7 +91,7 @@ let print fmt asta =
   pp "\nTop states: ";
   StateSet.print fmt asta.top;
   pp "\nTransitions: \n";
-  Format.fprintf fmt "{@[<hov n> %a @]}" (* todo: check boxes *)
+  Format.fprintf fmt "{@[<hov 2> %a @]}" (* todo: check boxes *)
     (Pretty.print_list ~sep:"@, " (Transition.print))
     (SetT.elements (asta.trans))
 
index 0dd1994..dff376f 100644 (file)
@@ -2,7 +2,7 @@
 (*                                                                     *)
 (*                               TAToo                                 *)
 (*                                                                     *)
-(*                  ?   *)
+(*                  Lucca Hirschi, ?   *)
 (*                  ?   *)
 (*                                                                     *)
 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
@@ -34,6 +34,9 @@ val transition : t -> state -> label -> formula
 val transitions : t -> state -> (label*formula) list
 (** Give the list of labels and formulae from transitions for a given state *)
 
+val dummy : t
+(** The empty automaton *)
+
 val print : Format.formatter -> t -> unit
 (** Describe the automaton as text *)
 
diff --git a/src/compil.ml b/src/compil.ml
new file mode 100644 (file)
index 0000000..30440f3
--- /dev/null
@@ -0,0 +1,16 @@
+(***********************************************************************)
+(*                                                                     *)
+(*                               TAToo                                 *)
+(*                                                                     *)
+(*                  Lucca Hirschi, ?   *)
+(*                  ?   *)
+(*                                                                     *)
+(*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
+(*  Recherche Scientifique. All rights reserved.  This file is         *)
+(*  distributed under the terms of the GNU Lesser General Public       *)
+(*  License, with the special exception on linking described in file   *)
+(*  ../LICENSE.                                                        *)
+(*                                                                     *)
+(***********************************************************************)
+
+let trad qu = Asta.dummy
diff --git a/src/compil.mli b/src/compil.mli
new file mode 100644 (file)
index 0000000..e21975d
--- /dev/null
@@ -0,0 +1,19 @@
+(***********************************************************************)
+(*                                                                     *)
+(*                               TAToo                                 *)
+(*                                                                     *)
+(*                  Lucca Hirschi, ?   *)
+(*                  ?   *)
+(*                                                                     *)
+(*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
+(*  Recherche Scientifique. All rights reserved.  This file is         *)
+(*  distributed under the terms of the GNU Lesser General Public       *)
+(*  License, with the special exception on linking described in file   *)
+(*  ../LICENSE.                                                        *)
+(*                                                                     *)
+(***********************************************************************)
+
+(** Implementation of compilation from XPath queries into ASTA *)
+
+val trad : XPath.Ast.path -> Asta.t
+(** Compilation function *)
index df5b112..8b69fd8 100644 (file)
     only the first line of XPath_querie_file is read 
 *)
 
-module F = Formula
-module G = Asta
-
-(* to force ocaml build to add Formula to the dependency chain even if
-   we don't use it yet*)
 
 let doc =
   let fd = open_in Sys.argv.(1) in
@@ -42,8 +37,11 @@ let query =
 
 open Format
 
+let asta = Compil.trad query
+
 let () =
   fprintf err_formatter "Query: %a\n%!" XPath.Ast.print query;
+  fprintf err_formatter "Asta: %a\n%!" Asta.print asta;
   fprintf err_formatter "Document:\n%!";
   Tree.print_xml stderr doc (Tree.root doc);
   exit 0