git.annexia.org
/
goals.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
In debug mode (-d) print all shell scripts executed.
[goals.git]
/
src
/
parser.mly
diff --git
a/src/parser.mly
b/src/parser.mly
index
aca014e
..
7146a99
100644
(file)
--- a/
src/parser.mly
+++ b/
src/parser.mly
@@
-60,11
+60,12
@@
let do_include env loc filename optflag file =
%}
(* Tokens. *)
%}
(* Tokens. *)
-%token <Ast.
substs
> CODE
+%token <Ast.
code
> CODE
%token COLON
%token COMMA
%token EQUALS
%token EOF
%token COLON
%token COMMA
%token EQUALS
%token EOF
+%token EXPRESSION
%token FUNCTION
%token GOAL
%token <string> ID
%token FUNCTION
%token GOAL
%token <string> ID
@@
-73,10
+74,14
@@
let do_include env loc filename optflag file =
%token LEFT_PAREN
%token LET
%token OPTINCLUDE
%token LEFT_PAREN
%token LET
%token OPTINCLUDE
+%token PURE
+%token RETURNING
%token RIGHT_ARRAY
%token RIGHT_PAREN
%token SEMICOLON
%token <Ast.substs> STRING
%token RIGHT_ARRAY
%token RIGHT_PAREN
%token SEMICOLON
%token <Ast.substs> STRING
+%token STRING_KEYWORD
+%token STRINGS
%token <string> TACTIC
%token TACTIC_KEYWORD
%token <string> TACTIC
%token TACTIC_KEYWORD
@@
-113,9
+118,9
@@
stmt:
let name, params = $1 in
name, Ast.EGoalDefn ($loc, (params, [], [], Some $2))
}
let name, params = $1 in
name, Ast.EGoalDefn ($loc, (params, [], [], Some $2))
}
- |
FUNCTION ID params
_decl EQUALS CODE
+ |
option(PURE) FUNCTION ID params_decl return
_decl EQUALS CODE
{
{
- $
2, Ast.EFuncDefn ($loc, ($3, $5
))
+ $
3, Ast.EFuncDefn ($loc, ($4, $5, $1 <> None, $7
))
}
| TACTIC_KEYWORD TACTIC params_decl EQUALS CODE
{
}
| TACTIC_KEYWORD TACTIC params_decl EQUALS CODE
{
@@
-133,13
+138,18
@@
params_decl:
;
param_decl:
| ID { $1 }
;
param_decl:
| ID { $1 }
+return_decl:
+ | { RetExpr }
+ | RETURNING EXPRESSION { RetExpr }
+ | RETURNING STRINGS { RetStrings }
+ | RETURNING STRING_KEYWORD { RetString }
patterns:
| separated_list(COMMA, pattern) { $1 }
;
pattern:
| STRING { Ast.PTactic ($loc, "*file", [$1]) }
patterns:
| separated_list(COMMA, pattern) { $1 }
;
pattern:
| STRING { Ast.PTactic ($loc, "*file", [$1]) }
- |
ID
pattern_params { Ast.PTactic ($loc, $1, $2) }
+ |
TACTIC
pattern_params { Ast.PTactic ($loc, $1, $2) }
;
pattern_params:
| LEFT_PAREN separated_list(COMMA, pattern_param) RIGHT_PAREN { $2 }
;
pattern_params:
| LEFT_PAREN separated_list(COMMA, pattern_param) RIGHT_PAREN { $2 }