-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Juvix to Isabelle/HOL translation #2752
Conversation
2f415c3
to
7bb8ce5
Compare
any ideas of how this could be tested? Maybe we could have a parser for the subset of isabelle that we are producing. Then we would manually write the expected isabelle file and store it in the test suite, and then we would compare asts between the generated code and the parsed code. We could also compare the text if we don't wan't to write a parser, but that's a bit brittle. |
b05deb8
to
23e2e56
Compare
23e2e56
to
cbb224c
Compare
That's a good question. I wanted to avoid both of these solutions (both require future maintenance) but I didn't have any better idea. How do we test HTML and Markdown generation? |
For Markdown, we have tests in
Let's install Isabelle in the CI, and test with it that the generation produces valid theories. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait for me, I need to test with some examples from the specs, before merging this.
It would be very helpful to learn what works and what still needs to be implemented/improved, but aside of obvious bugs I think any feature requests should be delegated to separate future PRs. So that we have an initial working version first, even if it's somewhat restricted in what it can handle. |
|
||
instance PrettyCode Theory where | ||
ppCode Theory {..} = do | ||
n <- ppCode _theoryName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The theory's name must correspond to the file's name. Currently, it's printing the qualified name of the Juvix module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is the generated file name different from the qualified named of the Juvix module? I think it's always the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can theory names in Isabelle contain dots?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error that says "Bad theory name .. with qualification" if we use dots.
However, I couldn't find any mention of this in the "Isabelle System Manual." So, they probably want the names of theories to be like regular names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, maybe then I just replace .
with e.g. __
in both file and theory names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That won't work either. Use the unqualified name of the module as the name of the theory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, can do that (potentially problematic in the future when translating multiple modules).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. But we can generate the Isabelle theories following the module's folder structure of the Juvix modules. We do this for HTML output. We can do that in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cbb224c
to
638d946
Compare
The single positive markdown test is very brittle because it just compares the output to a pre-stored file. I just had to regenerate it after changing some unrelated thing in the scoper, which changed the nameId numbers, which changed the generated markdown text. |
e0b0666
to
093f9c9
Compare
093f9c9
to
6de024d
Compare
6de024d
to
4ceb57a
Compare
4ceb57a
to
da8f71f
Compare
juvix isabelle program.juvix
which translates a given file to an Isabelle/HOL theory.--only-types
option.Blocked by: