From: Ferruccio Guidi Date: Tue, 10 Sep 2002 14:14:03 +0000 (+0000) Subject: new mathql interpreter X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=7cf92e106a75e3c45fb7307370fe8b921e4b5d41;p=helm.git new mathql interpreter --- diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index cf453c6f6..2c636eadf 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -26,6 +26,10 @@ (* * implementazione del'interprete MathQL *) + +(* +(* FG: ROBA VECCHIA DA BUTTARE (tranne apertura e chiusura database *) + open MathQL;; open Eval;; open Utility;; @@ -40,6 +44,8 @@ open Select;; open Letin;; open Mathql_semantics;; + + let prop_pool = ref None;; let fi_to_string fi = @@ -244,3 +250,46 @@ let execute q = *) let close () = Dbconn.close ();; +*****************************************************************************) + +type svar_context = (MathQL.svar * MathQL.resource_set) list + +type rvar_context = (MathQL.rvar * MathQL.resource) list + +type group_context = (MathQL.rvar * MathQL.attribute_group) list + + +let svars = ref [] (* contesto delle svar *) + +let rvars = ref [] (* contesto delle rvar *) + +let groups = ref [] (* contesto dei gruppi *) + + +(* valuta una MathQL.set_exp e ritorna un MathQL.resource_set *) + +let rec exec_set_exp = function + | MathQL.Ref x -> [] + + +(* valuta una MathQL.boole_exp e ritorna un boole *) + +and exec_boole_exp = function + | MathQL.False -> false + | MathQL.True -> true + | MathQL.Not x -> not (exec_boole_exp x) + | MathQL.And (x, y) -> (exec_boole_exp x) && (exec_boole_exp y) + | MathQL.Or (x, y) -> (exec_boole_exp x) || (exec_boole_exp y) + + +(* valuta una MathQL.val_exp e ritorna un MathQL.value *) + +and exec_val_exp = function + | MathQL.Const l -> [] + + +(* valuta una MathQL.set_exp nel contesto vuoto e ritorna un MathQL.resource_set *) + +let execute x = + svars := []; rvars := []; groups := []; + exec_set_exp x