| 1 |
From elpi Require Import elpi. |
| 2 |
|
| 3 |
Definition d1 := 3. |
| 4 |
Inductive i1 : Prop := k1. |
| 5 |
Record r1 : Type := { f1 : nat; _ : f1 = 1 }. |
| 6 |
Section A. Variable v : nat. End A. |
| 7 |
Module N1. End N1. Module M1 := N1. |
| 8 |
|
| 9 |
Elpi Command test. |
| 10 |
#[synterp] Elpi Accumulate lp:{{ |
| 11 |
main _ :- std.do! [ coq.env.begin-section "A", coq.env.end-section, coq.env.begin-module "N2" none, coq.env.end-module _]. |
| 12 |
}}. |
| 13 |
Elpi Accumulate lp:{{ |
| 14 |
main _ :- |
| 15 |
coq.env.add-const "d2" {{ 3 }} _ _ _, |
| 16 |
coq.env.add-indt (inductive "i2" tt (arity {{ Prop }}) i\[constructor "k2" (arity i) ]) _, |
| 17 |
coq.env.add-indt (record "r2" {{ Type }} "_" ( |
| 18 |
field _ "f2" {{ nat }} f2\ |
| 19 |
field _ _ {{ @eq nat lp:f2 1 }} _\ |
| 20 |
end-record)) _, |
| 21 |
coq.env.begin-section "A", |
| 22 |
coq.env.add-section-variable "v" _ {{ nat }} _, |
| 23 |
coq.env.end-section, |
| 24 |
coq.env.begin-module "N2" none, |
| 25 |
coq.env.end-module _, |
| 26 |
true. |
| 27 |
}}. |
| 28 |
|
| 29 |
Elpi Export test. |
| 30 |
test. |
| 31 |
Check d1. Check d2. |
| 32 |
Check i1. Check i2. |
| 33 |
Check k1. Check k2. |
| 34 |
Check r1. Check r2. |
| 35 |
Check f1. Check f2. |
| 36 |
Module M2 := N2. |
| 37 |
|
| 38 |
|
| 39 |
Elpi Query lp:{{ |
| 40 |
pi x\ |
| 41 |
decl x `x` {{:pat list _}} ==> decl x _ {{ list bool }}, decl x _ {{ list nat }}. |
| 42 |
}}. |
| 43 |
Fail Elpi Query lp:{{ |
| 44 |
pi x\ |
| 45 |
decl x `x` {{list _}} ==> decl x _ {{ list bool }}, decl x _ {{ list nat }}. |
| 46 |
}}. |