aboutsummaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
authorfilliatr1999-12-07 14:56:36 +0000
committerfilliatr1999-12-07 14:56:36 +0000
commitf2da732ffd5db2b93a2c8120c668f8b2f6068d3b (patch)
tree6cf46158c757cb654c241728eed3ea03bd04d0d0 /parsing
parent59263ca55924e2f43097ae2296f541b153981bf8 (diff)
debuggage inductifs (suite) / compilation Dhyp et Auto (mais pas linkes
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@220 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'parsing')
-rw-r--r--parsing/coqast.ml16
-rw-r--r--parsing/coqast.mli10
2 files changed, 26 insertions, 0 deletions
diff --git a/parsing/coqast.ml b/parsing/coqast.ml
index b0a825326c..0f0dcda29c 100644
--- a/parsing/coqast.ml
+++ b/parsing/coqast.ml
@@ -15,6 +15,22 @@ type t =
type the_coq_ast = t
+let subst_meta bl ast =
+ let rec aux = function
+ | Node (_,"META", [Num(_, n)]) -> List.assoc n bl
+ | Node(loc, node_name, args) ->
+ Node(loc, node_name, List.map aux args)
+ | Slam(loc, var, arg) -> Slam(loc, var, aux arg)
+ | other -> other
+ in
+ aux ast
+
+let rec collect_metas = function
+ | Node (_,"META", [Num(_, n)]) -> [n]
+ | Node(_, _, args) -> List.concat (List.map collect_metas args)
+ | Slam(loc, var, arg) -> collect_metas arg
+ | _ -> []
+
(* Hash-consing *)
module Hloc = Hashcons.Make(
struct
diff --git a/parsing/coqast.mli b/parsing/coqast.mli
index 006b98b3e0..3a02092cd4 100644
--- a/parsing/coqast.mli
+++ b/parsing/coqast.mli
@@ -1,6 +1,8 @@
(* $Id$ *)
+(* Abstract syntax trees. *)
+
type loc = int * int
type t =
@@ -13,5 +15,13 @@ type t =
| Path of loc * string list* string
| Dynamic of loc * Dyn.t
+(* returns the list of metas occuring in the ast *)
+val collect_metas : t -> int list
+
+(* [subst_meta bl ast]: for each binding [(i,c_i)] in [bl],
+ replace the metavar [?i] by [c_i] in [ast] *)
+val subst_meta : (int * t) list -> t -> t
+
+(* hash-consing function *)
val hcons_ast: (string -> string) -> (t -> t) * (loc -> loc)