X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Fast.mli;h=225e42975f75bf66431ad746e19026f865778206;hb=5e13f1e2a3dc1237fcf2fa141d8379bdd36bde61;hp=406a8293bf8710f83cdf353d9b508c194f34818f;hpb=f7198dfc6a473781b429871cb098325c1b8ce331;p=goals.git diff --git a/src/ast.mli b/src/ast.mli index 406a829..225e429 100644 --- a/src/ast.mli +++ b/src/ast.mli @@ -41,67 +41,58 @@ val string_loc : unit -> loc -> string variable or goal name -> expression. *) type env = expr Env.t and pattern = - (** match tactic such as *file ("filename") *) - | PTactic of loc * id * substs list + | PPred of loc * id * substs list + (** match predicate such as is-file ("filename") *) and expr = - (** goal (params) = patterns : exprs code *) | EGoalDefn of loc * goal - (** tactic (params) = code *) - | ETacticDefn of loc * tactic - (** call goalname (params) etc. *) - | ECallGoal of loc * id * expr list - (** call *tactic (params) etc. *) - | ETacticConstructor of loc * id * expr list - (** variable, or goal call with no parameters *) + (** goal (params) = patterns : exprs code *) + | EFuncDefn of loc * func + (** function (params) = code *) + | EPredDefn of loc * pred + (** predicate (params) = code *) + | ECall of loc * id * expr list + (** call goal (params) or function (params) *) + | EPredCtor of loc * id * expr list + (** constructor is-predicate (params) *) | EVar of loc * id - (** list *) + (** variable, or goal call with no parameters *) | EList of loc * expr list - (** string with %-substitutions *) + (** list *) | ESubsts of loc * substs - (** constant expression, such as a plain string, int, boolean, etc. *) + (** string with %-substitutions *) | EConstant of loc * constant + (** constant expression, such as a plain string, int, boolean, etc. *) and constant = | CString of string and goal = param_decl list * pattern list * expr list * code option -and tactic = param_decl list * code - (** Goal/tactic parameter. *) -and param_decl = id +and func = param_decl list * returning * bool * code +and pred = param_decl list * code +and param_decl = id (** goal/func/pred parameter. *) and id = string -and code = substs +and code = substs * bool (** code + quiet flag *) +and returning = RetExpr | RetStrings | RetString and substs = subst list and subst = - (** String literal part. *) | SString of string - (** %-substitution. *) + (** String literal part. *) | SVar of id + (** %-substitution. *) +val getvar : env -> loc -> id -> expr (** Look up a variable in the environment. Raise [Failure _] if not found. *) -val getvar : env -> loc -> id -> expr +val getgoal : env -> loc -> id -> goal (** Look up a goal in the environment. Raise [Failure _] if not found or if the named variable is not a goal. *) -val getgoal : env -> loc -> id -> goal - -(** Look up a tactic in the environment. Raise [Failure _] if not - found or if the named variable is not a tactic. *) -val gettactic : env -> loc -> id -> tactic - -(** Take any expression and simplify it down to a constant. - If the expression cannot be simplified then this raises - [Failure _]. *) -val to_constant : env -> expr -> constant -(** Take a substitution list and try to turn it into a simple - string by evaluating every variable. If not possible this - raises [Failure _]. *) -val substitute : env -> loc -> substs -> string +val getfunc : env -> loc -> id -> func +(** Look up a function in the environment. Raise [Failure _] if not + found or if the named variable is not a function. *) -(** Similar to {!substitute} except this is used where we will - pass the result immediately to the shell to execute. Variables - are substituted with shell quoted strings. Raises [Failure _] - on error. *) -val to_shell_script : env -> loc -> substs -> string +val getpred : env -> loc -> id -> pred +(** Look up a predicate in the environment. Raise [Failure _] if not + found or if the named variable is not a predicate. *) (** This is used for incrementally building Ast.substs in the parser. *) module Substs : sig