coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Zoe Paraskevopoulou <zoe.paraskevopoulou AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Question about writing plugins/vercular commands extension
- Date: Fri, 31 Jan 2020 12:55:36 -0500
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=zoe.paraskevopoulou AT gmail.com; spf=Pass smtp.mailfrom=zoe.paraskevopoulou AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk1-f196.google.com
- Ironport-phdr: 9a23:cmcDuBTGv6UORh6K+GRDbLJJ/Npsv+yvbD5Q0YIujvd0So/mwa6ybBaN2/xhgRfzUJnB7Loc0qyK6vymBTRLsMnJ8ChbNsAVDFld0YRetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScbdgMutyu+95YDYbRlWizqhe7NyKwi9oRnMusUMjoZuN6k8xgHGr3dUdOhbwWFlLk+Xkxrg+8u85pFu/zletv4768JMTaD2dLkkQLJFCzgrL3o779DxuxnZSguP6HocUmEInRdNHgPI8hL0UIrvvyXjruZy1zWUMsPwTbAvRDSt9LxrRwPyiCcGLDE27mfagdFtga1BoRKhoxt/w5PIYIyQKfFzcL/Rcc8cSGFcWMtaSi5PDZ6mb4YXD+QOIelWoIbgqVUAoxuwGwujCuDoxDJTmn/2xKg63/ghEQ3a3gEtGc8FvnTOrNXyMacfSeO6zK7Wwj7edf1Zwy3955LTchAiv/6MQ7VwcdLWyUkyEwPFiUiQopHiMjKU0eQCrXKX7/J6WuK1kWEnsAJxrSaxxscrkonJgZ8VylTD9SVk24s1Kti4R1R6Yd6gCpdfqyaaN45vT84kXmpmtiE6yrgctp66eigH0Jsnxx/Da/yHboiH+QjvW/qWITd9gn9uZbGxhw6q/ES+1uHxUtO43VVKoyZfjNXAqG4B2wbO5sWDS/Zx5lqt1DmT2wzJ9+1JIlw4mbDFJ5Mu37I8jIcfvVjFEyTrgkv5lrWWeV8h+uWw6+TofLHmppiEOo9xkA7+M6AultWmAeQ7LwQCRmab9fm42bDi50H5T7JKjvo5kqndrp/WP9gUpqm8AwNN04Yj7QiwDyu+3dgGgXUKKEhJdRGHgoTzJV3CPu70Ae2ij1mokTpn3/XGMafgApXJIHjDirDhfbNl5k9dzwo808pT54pOBbEbOv3zQUzxu8LGDh8+Kwy0xPvnCNF61oMDQm+PDaqZP7nTsV+M/O4gP+6MZIoNtDbnN/cl/+LujWM+mVIFYaap2oIXZGmkEfRiPkWWemHhgswBEGcPpgoxVvbmiFyEUT5JZna9Rbgw5j8hCNHuMYCWTYe0xbeFwS2TH5tMZ2kABErfP23vctC2XPpEUCuIK9RinyIDTb+8T4g8nUW8swK807N9J/HX9zMfrZX+0N9oz+LWnBA2szdzCpLOgCm2U2hokzZQFHcN16dlrBklkwrR4e1Dm/VdUOdrybZJXwM9b8COyuV7D5XrWVuEcI7YFhCpRdKpBTx3RdU0kYdXPxRNXu66hxWG5BKERqcPnuXSVpMx+6PYmXP2IpQlkieU5Owal1AjB/B3Gyijj697+RLUAteQwUqcnqeuM68b2XyU+Q==
Hi Talia, Gaëtan,
Thank you both for your answers.
> On Jan 31, 2020, at 5:22 AM, Gaëtan Gilbert
> <gaetan.gilbert AT skyskimmer.net>
> wrote:
>
> Did you open Stdarg?
Yes. My (relevant) imports right now are:
open Stdarg
open Pp
open Ltac_plugin
> On Jan 31, 2020, at 2:53 AM, Talia Ringer
> <tringer AT cs.washington.edu>
> wrote:
>
> Maybe a silly question, but does it work if you use { } instead of [ ]? I
> don't know if you just copied over the code incorrectly. The error messages
> for .mlg files are always bewildering. Apologies if it's not that. I
> haven't used VERNAC ARGUMENT EXTEND before.
Ah, that’s an interesting observation. My file is an .ml4 file (which seems
deprecated for this purpose, but I never knew until now) and the syntax is
exactly the syntax that I use in the file (in fact the {} syntax gives me a
syntax error in .ml4). But I’ll try to change it to .mlg and see if that
works.
> Whenever you do figure this out, I'd like to add an example to one of the
> plugin tutorials in the Coq repo. Please let me know if you are willing to
> share a minimal example for that.
Sure thing! I can submit something to the Coq plugin tutorial, once I get
something working.
Cheers,
Zoe
> On Jan 31, 2020, at 5:22 AM, Gaëtan Gilbert
> <gaetan.gilbert AT skyskimmer.net>
> wrote:
>
> Did you open Stdarg?
>
> Gaëtan Gilbert
>
> On 30/01/2020 21:18, Zoe Paraskevopoulou wrote:
>> Hi Coq Club,
>> I’ve been trying to write a vernacular command that parses some optional
>> arguments, but I’m facing some issue and I’d appreciate some help.
>> The result I’m trying to achieve is:
>> CertiCoq Compile [options] <global_identifier>
>> where [options] is zero or more compilation flags like -debug.
>> For this I wrote the following code:
>> type command_args =
>> | ANF
>> | TIME
>> | OPT of int
>> | DEBUG
>> | ARGS of int
>> VERNAC ARGUMENT EXTEND cargs
>> | [ "-anf" ] -> [ ANF ]
>> | [ "-time" ] -> [ TIME ]
>> | [ "-o1" ] -> [ OPT(1) ]
>> | [ "-debug" ] -> [ DEBUG ]
>> | [ "-args" int(n) ] -> [ ARGS(n) ]
>> END.
>> However, when I compile I get the following error:
>> File "g_certicoq.ml4", line 1, characters 0-0:
>> Error: This expression has type int -> Pp.t
>> but an expression was expected of type
>> 'a Extend.entry = 'a Grammar.GMake(CLexer).Entry.e
>> This happens whenever I try to parse a non-terminal symbols (e.g.
>> string()) in VERNAC ARGUMENT EXTEND, not just with int().
>> If I drop the last case of cargs and parse this option at the VERNAC
>> COMMAND instead, everything works:
>> VERNAC COMMAND EXTEND CertiCoq_Compile CLASSIFIED AS QUERY
>> | [ "CertiCoq" "Compile" cargs_list(l) “-args” int(x) global(gr) ] -> [
>> ... do stuff ... ]
>> END
>> Any idea about what is going on? I’m suspecting that I’m missing an import
>> because I’ve seen this type of parsing in VERNAC ARGUMENT EXTEND before.
>> For example here:
>> https://github.com/coq/coq/blob/master/plugins/ltac/g_ltac.mlg. I tried to
>> use the same imports but that didn’t help.
>> I am using Coq 8.9.1 and OCaml 4.07.0.
>> Cheers,
>> Zoe
- [Coq-Club] Question about writing plugins/vercular commands extension, Zoe Paraskevopoulou, 01/30/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Talia Ringer, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Gaëtan Gilbert, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Zoe Paraskevopoulou, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Zoe Paraskevopoulou, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Talia Ringer, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Zoe Paraskevopoulou, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Talia Ringer, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Zoe Paraskevopoulou, 01/31/2020
- Re: [Coq-Club] Question about writing plugins/vercular commands extension, Zoe Paraskevopoulou, 01/31/2020
Archive powered by MHonArc 2.6.18.