let path = inc // filename in
if Sys.file_exists path then path else loop incs
in
- loop Cmdline.includes
+ loop (Cmdline.includes ())
)
let do_include env loc filename optflag file =
%token LEFT_PAREN
%token LET
%token OPTINCLUDE
+%token PURE
%token RETURNING
%token RIGHT_ARRAY
%token RIGHT_PAREN
%token <Ast.substs> STRING
%token STRING_KEYWORD
%token STRINGS
-%token <string> TACTIC
-%token TACTIC_KEYWORD
+%token <string> PRED
+%token PREDICATE
(* Start nonterminals. *)
%start <Ast.expr Ast.Env.t> file
-%start <Ast.expr> expr
+%start <Ast.expr> expr_only
%%
file:
let name, params = $1 in
name, Ast.EGoalDefn ($loc, (params, [], [], Some $2))
}
- | FUNCTION ID params_decl return_decl EQUALS CODE
+ | GOAL ID
{
- $2, Ast.EFuncDefn ($loc, ($3, $4, $6))
+ $2, Ast.EGoalDefn ($loc, ([], [], [], None))
}
- | TACTIC_KEYWORD TACTIC params_decl EQUALS CODE
+ | option(PURE) FUNCTION ID params_decl return_decl EQUALS CODE
{
- $2, Ast.ETacticDefn ($loc, ($3, $5))
+ $3, Ast.EFuncDefn ($loc, ($4, $5, $1 <> None, $7))
+ }
+ | PREDICATE PRED params_decl EQUALS CODE
+ {
+ $2, Ast.EPredDefn ($loc, ($3, $5))
}
| LET ID EQUALS expr { $2, $4 }
;
| separated_list(COMMA, pattern) { $1 }
;
pattern:
- | STRING { Ast.PTactic ($loc, "*file", [$1]) }
- | TACTIC pattern_params { Ast.PTactic ($loc, $1, $2) }
+ | STRING { Ast.PPred ($loc, "is-file", [$1]) }
+ | PRED pattern_params { Ast.PPred ($loc, $1, $2) }
;
pattern_params:
| LEFT_PAREN separated_list(COMMA, pattern_param) RIGHT_PAREN { $2 }
expr:
| ID params { Ast.ECall ($loc, $1, $2) }
| ID { Ast.EVar ($loc, $1) }
- | TACTIC params { Ast.ETacticCtor ($loc, $1, $2) }
+ | PRED params { Ast.EPredCtor ($loc, $1, $2) }
| STRING { Ast.ESubsts ($loc, $1) }
| LEFT_ARRAY barelist RIGHT_ARRAY { Ast.EList ($loc, $2) }
;
| LEFT_PAREN separated_list(COMMA, expr) RIGHT_PAREN { $2 }
;
+(* This is used by Parse.parse_expr where we have to parse
+ * a standalone string (eg. from the command line).
+ *)
+expr_only:
+ | expr EOF { $1 }
+ ;
+
(* http://gallium.inria.fr/blog/lr-lists/ *)
right_flexible_list(delim, X):
| (* nothing *) { [] }