git.annexia.org
/
goals.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement tactics.
[goals.git]
/
src
/
parser.mly
diff --git
a/src/parser.mly
b/src/parser.mly
index
5a2ce9b
..
3a17124
100644
(file)
--- a/
src/parser.mly
+++ b/
src/parser.mly
@@
-36,6
+36,7
@@
open Printf
%token RIGHT_PAREN
%token <Ast.substs> STRING
%token <string> TACTIC
%token RIGHT_PAREN
%token <Ast.substs> STRING
%token <string> TACTIC
+%token TACTIC_KEYWORD
(* Start nonterminals. *)
%start <Ast.env> file
(* Start nonterminals. *)
%start <Ast.env> file
@@
-67,24
+68,29
@@
stmt:
let name, params = $1 in
name, Ast.EGoal ($loc, (params, [], [], Some $2))
}
let name, params = $1 in
name, Ast.EGoal ($loc, (params, [], [], Some $2))
}
+ | TACTIC_KEYWORD TACTIC params_decl EQUALS CODE
+ {
+ $2, Ast.ETactic ($loc, ($3, $5))
+ }
| LET ID EQUALS expr { $2, $4 }
;
goal_stmt:
| LET ID EQUALS expr { $2, $4 }
;
goal_stmt:
- | GOAL ID option(param_decl) EQUALS
+ | GOAL ID option(param
s
_decl) EQUALS
{ $2, match $3 with None -> [] | Some ps -> ps }
;
{ $2, match $3 with None -> [] | Some ps -> ps }
;
-param_decl:
- | LEFT_PAREN separated_list(COMMA,
ID
) RIGHT_PAREN { $2 }
+param
s
_decl:
+ | LEFT_PAREN separated_list(COMMA,
param_decl
) RIGHT_PAREN { $2 }
;
;
+param_decl:
+ | ID { $1 }
patterns:
| separated_list(COMMA, pattern) { $1 }
;
pattern:
patterns:
| separated_list(COMMA, pattern) { $1 }
;
pattern:
- | STRING { Ast.PTactic ($loc, "file", [$1]) }
+ | STRING { Ast.PTactic ($loc, "
*
file", [$1]) }
| ID pattern_params { Ast.PTactic ($loc, $1, $2) }
| ID pattern_params { Ast.PTactic ($loc, $1, $2) }
- | ID { Ast.PVar ($loc, $1) }
;
pattern_params:
| LEFT_PAREN separated_list(COMMA, pattern_param) RIGHT_PAREN { $2 }
;
pattern_params:
| LEFT_PAREN separated_list(COMMA, pattern_param) RIGHT_PAREN { $2 }
@@
-94,9
+100,9
@@
pattern_param:
;
expr:
;
expr:
- | ID params { Ast.ECall ($loc, $1, $2) }
+ | ID params { Ast.ECall
Goal
($loc, $1, $2) }
| ID { Ast.EVar ($loc, $1) }
| ID { Ast.EVar ($loc, $1) }
- | TACTIC params { Ast.ETactic ($loc, $1, $2) }
+ | TACTIC params { Ast.E
Call
Tactic ($loc, $1, $2) }
| STRING { Ast.ESubsts ($loc, $1) }
| LEFT_ARRAY barelist RIGHT_ARRAY { Ast.EList ($loc, $2) }
;
| STRING { Ast.ESubsts ($loc, $1) }
| LEFT_ARRAY barelist RIGHT_ARRAY { Ast.EList ($loc, $2) }
;