-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
coq.env.add-context
for inserting context declarations (#737)
--------- Co-authored-by: Enrico Tassi <[email protected]> Co-authored-by: Cyril Cohen <[email protected]>
- Loading branch information
1 parent
a7ea250
commit 84c46ef
Showing
16 changed files
with
107 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
"fb3515feec422e546de863ad0101e2a51ec9b8db" | ||
"15528c384deb76abecd596520bc3d9986b06344d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
|
||
let is_number x = try let _ = int_of_string x in true with _ -> false ;; | ||
|
||
let main () = | ||
let v = Sys.argv.(1) in | ||
let v' = Str.(replace_first (regexp "^v") "" v) in (* v1.20... -> 1.20... *) | ||
let v' = Str.(replace_first (regexp "-.*$") "" v') in (* ...-10-fjdnfs -> ... *) | ||
let l = String.split_on_char '.' v' in | ||
(* sanitization *) | ||
let l = | ||
match l with | ||
| l when List.for_all is_number l -> l | ||
| [_] -> ["99";"99";"99"] | ||
| _ -> Printf.eprintf "version_parser: cannot parse: %s\n" v; exit 1 in | ||
let a,b,c = Elpi.API.Utils.version_parser ~what:"elpi" v in | ||
let open Format in | ||
printf "(%a)%!" (pp_print_list ~pp_sep:(fun fmt () -> pp_print_string fmt ", ") pp_print_string) l | ||
printf "(%d,%d,%d)%!" a b c | ||
;; | ||
|
||
main () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
From elpi Require Import elpi. | ||
|
||
Elpi Command context. | ||
Elpi Accumulate lp:{{ | ||
main [ctx-decl Ctx] :- !, | ||
coq.env.add-context Ctx. | ||
}}. | ||
|
||
Section CA. | ||
Elpi context Context (a : nat) [b : nat] {c : nat} (d : nat := 3) (e := 4). | ||
Check eq_refl : d = 3. | ||
Check eq_refl : e = 4. | ||
Definition foo := a + b + c + d + e. | ||
End CA. | ||
Print foo. | ||
|
||
Elpi Query lp:{{ | ||
coq.arguments.implicit {coq.locate "foo"} [[explicit, implicit, maximal]]. | ||
}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters