## 10.1 Syntax

The syntax of the tactic language is given in table 10.1. We use a BNF-like notation. Terminal symbols are set in sans serif font (like this). Non-terminal symbols are set in italic font (like that). ... | ... denotes the or operation. ...* denotes zero, one or several repetitions. ...+ denotes one or several repetitions. Parentheses (...) denote grouping. The main entry is expr and the entries nat, ident, term and primitive_tactic represent respectively the natural numbers, the authorized identificators, Coq's terms and all the basic tactics. In term, there can be specific variables like ?n where n is a nat or ?, which are metavariables for pattern matching. ?n allows us to keep instantiations and to make constraints whereas ? shows that we are not interested in what will be matched.
This language is used in proof mode but it can also be used in toplevel definitions as shown in table 10.2.

> 6in

> expr | ::= | expr ; expr
> | | | expr ; [ (expr |)* expr ]
> | | | atom
> atom | ::= | Fun input_fun+ -> expr
> | | | Let (let_clause And)* let_clause In expr
> | | | Rec rec_clause
> | | | Rec (rec_clause And)* rec_clause In expr
> | | | Match Context With (context_rule |)* context_rule
> | | | Match term With (match_rule |)* match_rule
> | | | ( expr )
> | | | ( expr expr+ )
> | | | atom Orelse atom
> | | | Do (int | ident) atom
> | | | Repeat atom
> | | | Try atom
> | | | First [ (expr |)* expr ]
> | | | Solve [ (expr |)* expr ]
> | | | Idtac
> | | | Fail
> | | | primitive_tactic
> | | | arg
> input_fun | ::= | ident
> | | | ()
> let_clause | ::= | ident = expr
> rec_clause | ::= | ident input_fun+ -> expr
> context_rule | ::= | [ (context_hyps ;)* context_hyps |- term ] -> expr
> | | | [ |- term ] -> expr
> | | | _ -> expr
> context_hyps | ::= | ident : term
> | | | _ : term
> match_rule | ::= | [ term ] -> expr
> | | | _ -> expr
> arg | ::= | ()
> | | | nat
> | | | ident
> | | | 'term

> Table 10.1: Syntax of the tactic language

> 6in

> top | ::= | Tactic Definition ident input_fun* := expr
> | | | Recursive Tactic Definition (trec_clause And)* trec_clause
> trec_clause | ::= | ident input_fun+ := expr

> Table 10.2: Tactic toplevel definitions