Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Coq term parsers

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Coq term parsers


Chronological Thread 
  • From: e AT x80.org (Emilio Jesús Gallego Arias)
  • To: Talia Ringer <tringer AT cs.washington.edu>
  • Cc: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Coq term parsers
  • Date: Wed, 22 Feb 2017 21:58:40 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=e AT x80.org; spf=Neutral smtp.mailfrom=e AT x80.org; spf=None smtp.helo=postmaster AT cc-tupan-roaming-b.ensmp.fr
  • Ironport-phdr: 9a23:0Akk3Ba2FLFWIEhDZwUDWtv/LSx+4OfEezUN459isYplN5qZr8+ybnLW6fgltlLVR4KTs6sC0LuL9fm+EjVcu96oizMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCzbL52LBi6txjdu8gZjYd/Jas91AbCr2dVdehR2W5mP0+YkQzm5se38p5j8iBQtOwk+sVdT6j0fLk2QKJBAjg+PG87+MPktR/YTQuS/XQcSXkZkgBJAwfe8h73WIr6vzbguep83CmaOtD2TawxVD+/4apnVAPkhSEaPDMi7mrZltJ/g75aoBK5phxw3YjUYJ2ONPFjeq/RZM4WSXZdUspUUSFKH4GyYJYVD+cZPehWsZTzp1wArRWwBwaiB+3gxTBUiXH5xqA6z/0hHBva0AA8Bd8DsnLZp8j1OqcIVuC1ybHFwivYYvJZ2jrx9JLEchc7ofGDQLl8dcXfyUwuFwPBj1WQrpHuMTeL2eQWqXCb9PdrW+O1hG4jrwF+vDevxsAxgYTVnIIVy0rL9T58zIszONa2Rkl7Ydu+H5tRsSGXL4R2QsI+Q2FopSY10acKtoK8fCgPzpks2h3Ra+SffoSV5h/uW/ydLSlliH9qYr6zmha//Eu6xuHhWMS50U5GoylEn9XWt30A1Qbf58ydRvZz/Eqs3yuE2RrJ5eFeO080kLLWK54/zb40kZoeqVjMETPvlEXqka+Wbl8r+u6x5+T9ZbXpvJqcN45yigHxK6ghgdazDvo+MggVWmib4f6w1LP5/UHhQbVKiOM5krXBvZzHIckWqbS1DxFI3oss8RqzEjer3dcCkXUaIl9IeQqLj43zNFHPJPD4A+2/g1OpkDpz2f/LJbLgD5bRInTZl7fhZ7l951ZGyAUv1dBf+45UCrYZLf3vXU/xrcXUAQM9Mwyp2OnqE85914MbWWKXGKCVKqLSsVmS5uIuOeaAfoEVuCyuY8QissLniX4w0WUce6akx9NDdGq5GPtrOW2Sejzzi8wBEGEFog04CuHmlQvRfyRUYiO/d7Jsvnc8Eo3uTarGR4Ssh/Sj0TwpBdV5b2RCB1+LWV7ydoyfGqRfIBmOK9Nsx2RXHYOqTJUsgFT37Ff3
  • Organization: X80 Heavy Industries

Hi Talia,

Talia Ringer
<tringer AT cs.washington.edu>
writes:

> For a project I'm working on, I need to be able to get ASTs for Coq terms.
> So far I'm aware of a few options:
>
> - JSON extraction in 8.5, which does not work for us because we also
> need information in Prop
> - A Peacoq plugin which we are trying to get working
> - The XML protocol, which I know nothing about (is this useful?) but see
> referenced in old Coq-club threads
> - template-coq, which is neat but does not fit our needs
>
> I'm wondering if anyone knows of any other parsers that produce ASTs for
> Coq terms, including Props, preferably as s-expressions (or something
> similarly versatile).

I am replying quite late and indeed we have discussed about this
elsewhere, but I am replying here anyways for completeness.

Another potentially useful ─ but quite experimental approach ─ is
coq-serapi [1]

Indeed, coq-serapi has been designed for the particular purpose of
exporting Coq AST and protocols in a format suitable for mechanical
manipulation.

The project may not seem very active these days, but this is for we are
busy trying to incorporate into Coq 8.7 some changes that will make
SerAPI work much better.

To process a Coq file in SerAPI, you'd usually do:

(StmAdd () $FILE_CONTENTS)

This will parse and load a whole file, assigning "State IDs" to each
sentence.

Then, you could query for the AST of state sid:

(Query () (Ast sid))

for a particular definition:

(Query () (Definition "id"))

goals, etc... We'd be glad to take issues or questions on GitHub.

Best,
Emilio

[1] https://github.com/ejgallego/coq-serapi




Archive powered by MHonArc 2.6.18.

Top of Page