Skip to content

Commit 2a7507f

Browse files
committed
Re-enable Alectryon with vsrocqtop
1 parent 5cc023f commit 2a7507f

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

.github/pip-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
alectryon == 1.4.0
1+
alectryon @ git+https://github.com/cpitclaudel/alectryon@next
22
git+https://github.com/epfl-systemf/SpecMerger
33
requests == 2.32.4
44
beautifulsoup4 == 4.12.3

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ jobs:
6464
echo "::group::Install opam packages"
6565
opam pin add -n -k version coq ${{ matrix.rocq }}
6666
opam install --confirm-level=unsafe-yes --deps-only .
67+
# vsrocqtop is needed by Alectryon
68+
opam install --confirm-level=unsafe-yes vsrocq-language-server
6769
echo "::endgroup::"
6870
6971
echo "::group::Print opam config (post-install)"

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ The mechanization has the following properties:
3737
npm install # Install packages used by our JavaScript code
3838
npm install -g webpack-cli # Install webpack-cli, which is used to pack the code in monolithic JavaScript files
3939
```
40+
3. **[Optional]**
41+
[Alectryon](https://github.com/cpitclaudel/alectryon) is used to produced literate examples.
42+
You will also need [vsrocqtop](https://github.com/rocq-prover/vsrocq).
43+
```
44+
opam install vsrocq-language-server
45+
```
46+
4047
Alternatively, a [nix](https://nixos.org/) flake installing all the dependencies is provided:
4148
```
4249
nix develop
@@ -48,7 +55,7 @@ npm install
4855
- `dune exec example` will run an example of matching a string with a regex ([source](examples/ocaml_example/Main.ml)).
4956
- **[Requires JavaScript dependencies]**
5057
`dune exec fuzzer` will build and run the fuzzer to compare the extracted engine against Irregexp (Node.js's regex engine).
51-
- `dune build examples/rocq_proof` will build everything so that you can step through [examples/rocq-proof/Example.v](examples/rocq_proof/Example.v), which demonstrates how Warblre can be used to reason about JavaScript regexes.
58+
- `dune build examples/rocq_proof` will build everything so that you can step through [examples/rocq-proof/Example.v](examples/rocq_proof/Example.v), which demonstrates how Warblre can be used to reason about JavaScript regexes. Alternatively, if you installed Alectryon, you can open the generated [webpage](_build/default/examples/rocq_proof/Example.html) in your web browser.
5259
5360
## Structure of the repository
5461

examples/rocq_proof/dune

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
; LATER: re-enable when Alectryon supports Rocq 9.0
2-
; (rule
3-
; (target Example.html)
4-
; (deps (package warblre) (:input (file Example.v)))
5-
; (action
6-
; (run alectryon -Q ../../mechanization Warblre --long-line-threshold -1 %{input}))
7-
; (enabled_if %{bin-available:alectryon}))
1+
(rule
2+
(target Example.html)
3+
(deps (package warblre) (:input (file Example.v)))
4+
(action
5+
(run alectryon --coq-driver vsrocq -Q ../../mechanization Warblre --long-line-threshold -1 %{input}))
6+
(enabled_if %{bin-available:alectryon}))
87

9-
; (rule
10-
; (target dummy)
11-
; (action (progn
12-
; (echo "Alectryon not installed: skipping examples/rocq_proof\n")
13-
; (write-file dummy "")))
14-
; (enabled_if (not %{bin-available:alectryon})))
8+
(rule
9+
(target dummy)
10+
(action (progn
11+
(echo "Alectryon not installed: skipping examples/rocq_proof\n")
12+
(write-file dummy "")))
13+
(enabled_if (not %{bin-available:alectryon})))

specification_check/rocq_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dataclasses import dataclass
55
from typing import Dict, List, Tuple
66

7-
from alectryon.literate import Comment, StringView, coq_partition
7+
from alectryon.literate import Comment, StringView, CoqParser
88
from spec_merger.aligner_utils import Position
99
from spec_merger.content_classes.dictionary import Dictionary
1010
from spec_merger.content_classes.string import String
@@ -96,7 +96,7 @@ def __process_lines(self, rocq_code, all_filenames, matcher: re.Pattern) -> list
9696
comments = []
9797
for filename in all_filenames:
9898
file = rocq_code[filename]
99-
partition = coq_partition(file)
99+
partition = CoqParser(file).partition()
100100
for field in partition:
101101
if isinstance(field, Comment) and matcher.match(str(field.v)):
102102
start_line_num = ROCQParser.__get_line_num(field.v)

0 commit comments

Comments
 (0)