Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mmcco/verified-parser-example
A minimal example of a formally verified parser using ocamllex and Menhir's Coq backend.
https://github.com/mmcco/verified-parser-example
Last synced: 3 months ago
JSON representation
A minimal example of a formally verified parser using ocamllex and Menhir's Coq backend.
- Host: GitHub
- URL: https://github.com/mmcco/verified-parser-example
- Owner: mmcco
- License: bsd-3-clause
- Created: 2015-03-13T23:36:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-19T04:36:25.000Z (over 9 years ago)
- Last Synced: 2024-02-17T07:34:57.108Z (9 months ago)
- Language: Coq
- Size: 230 KB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# verified-parser-example
A minimal example of a formally verified parser using ocamllex and Menhir's Coq
backend.This would seem to be simpler than it is, as the interaction between the lexer
(directly generated OCaml) and the parser (OCaml extracted from generated Coq)
is nonobvious, not standardized, and generally undocumented.## Requirements
* Coq
* OCaml (with ocamlfind and ocamllex, which should be included)
* the OCaml Batteries library
* Menhir## On the parser
A Coq backend (using the `--coq` flag) exists in Menhir. It
originated in and is used by [CompCert](http://compcert.inria.fr/). It isn't
yet included in the Menhir documentation, but its section is drafted and will
be added soon. CompCert and this repo are the only parsers written with this
backend that I'm aware of. CompCert uses a lot of interesting techniques, but
is very complex because of the pre-parser necessary to deal with warts in
C specifications.Jacques-Henri Jourdan, the author of the verified parser, has written a
[blog post](http://gallium.inria.fr/~scherer/gagallium/verifying-a-parser-for-a-c-compiler/index.html)
and a [journal article](http://gallium.inria.fr/~xleroy/publi/validated-parser.pdf)
describing it at a conceptual and theoretical level.## Notes
Piecing together the OCaml bits was made harder by my lack of experience with
the languages, so there may be some dumb choices in build strategy, style,
conventions, etc. If you notice any, please let me know.This was written as part of Joe Politz's programming languages seminar at
Swarthmore College. It's an early step in our investigation of verifying
kernel-level interpreters such as BPF.Thanks to Jacques-Henri Jourdan, who was very open and helpful.