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 =
%}
(* Tokens. *)
-%token <Ast.substs> CODE
+%token <Ast.code> CODE
%token COLON
%token COMMA
%token EQUALS
%token LEFT_PAREN
%token LET
%token OPTINCLUDE
+%token PURE
%token RETURNING
%token RIGHT_ARRAY
%token RIGHT_PAREN
(* 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))
+ }
+ | option(PURE) FUNCTION ID params_decl return_decl EQUALS CODE
+ {
+ $3, Ast.EFuncDefn ($loc, ($4, $5, $1 <> None, $7))
}
| TACTIC_KEYWORD TACTIC params_decl EQUALS CODE
{
| 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 *) { [] }