New tool why3pp (pretty print)
This MR introduces a tool why3 pp
to pretty print (portions of) mlw files, and is a continuation of !146 (closed).
- It can be used to print inductive definitions to latex, as before
$ cat test1.mlw module Test inductive t n = Z : t 0 | S : t n -> t (n+1) end $ why3 pp --output=latex --kind=inductive test.mlw test.Test.t % \newcommand{\INDn}[0]{\mathsf{n}} % \newcommand{\INDtun}[1]{\mathsf{t}(#1)} \begin{mathparpagebreakable} % Test.t \inferrule[Z] {~} {\INDtun{0}} \\ \inferrule[S] {\INDtun{\INDn}} {\INDtun{\INDn + 1}} \\ \end{mathparpagebreakable}
- it contains the starting point of a formtting tool for mlw files
$ cat test2.mlw module Test let f xxxxxxxxxxxxxxxxxxxxxxxxxx = let yyyyyyyyyyyyyyyyyyyy = xxxxxxxxxxxxxxxxxxxxxxxxxx + 1 in yyyyyyyyyyyyyyyyyyyy + yyyyyyyyyyyyyyyyyyyy end $ why3 pp --output=mlw test2.mlw module Test let f xxxxxxxxxxxxxxxxxxxxxxxxxx = (let yyyyyyyyyyyyyyyyyyyy = (xxxxxxxxxxxxxxxxxxxxxxxxxx + 1) in (yyyyyyyyyyyyyyyyyyyy + yyyyyyyyyyyyyyyyyyyy)) end
Mlw_printer
, which formats aPtree
into concrete syntax) - In comparison with !146 (closed), pretty printing is now based on the
Ptree
instead of the typed tree. This simplifies the printing of record creations and updates (no reconstruction required anymore), and is made possible by a commit from @rmalak's branchptree_parser_pp
that is part of this MR.
Edited by Benedikt Becker
Merge request reports
Activity
added component: tools label
- Edited by Benedikt Becker
added 20 commits
-
5113bdde...99391c87 - 3 commits from branch
master
- 596f3a1b - This is an experimental branch to play with Ptree's
- d8970daf - Adapt Lexer interface to ptree to incremental parser
- a2f16cae - Add tool why3latex
- ed67d736 - Document why3latex in manpages.tex
- c78f2587 - Generalize and rename why3latex to why3pretty
- 3a41f1b7 - Update manpages.tex for the pretty tool
- 8beb7add - Rewrite why3pretty using Ptree
- fa44bfb2 - Simplify why3pretty
- fcd5e0be - Correct printing of operators and applications
- 3be4cc3e - Exception syntax
- 44adf024 - Pretty print mlw
- 75e1a21b - Continue Mlw_printer: more syntactic categories and indention
- 25350a6b - Rename why3pretty to why3pp
- 07e0c8ed - update handcrafted.messages
- 2e53efbd - Don't use Format.kasprintf
- 4acc3f10 - Don't use String.equal
- 612b4246 - Improve printing of mlw code
Toggle commit list-
5113bdde...99391c87 - 3 commits from branch
added 1 commit
- 93f2cde2 - Move mlw_printer from directory mlw/ to parser/
added 2 commits
added To be discussed label
@marche I would prefer to test again the printing of inductive definitions as latex before merging (e.g. on CoLiS semantics). Also, the pretty printing as mlw source code isn’t very pretty nor complete yet. But to not have this MR delay too much I could also complete that later.
Please register or sign in to reply