-
Notifications
You must be signed in to change notification settings - Fork 126
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
Markdown code fence delimiting #857
Comments
For the class, we’d like to be able to differentiate between cryptol and cryptol-repl (or cryptol-interpreter). |
I am not sure if that's a bug or a feature, as the code is purposefully written to work that way, and either I didn't write the original or have forgotten the reasoning behind it :) It's easy enough to change, we should just decide how we'd like it to work. I think it is useful to have something more than just So maybe allowing any string starting with @weaversa are you suggesting that it'd be nice to have a different code block that would contain Cryptol REPL commands, and would be interpreted differently while loading? If so, I think that's a very interesting idea, but maybe we should make a separate ticket to workout exactly how it should work (e.g., when should the commands be loaded, do we want to capture their output |
While we're discussing it, I also noticed that Markdown and Cryptol both being layout sensitive leads to some interesting interaction. My first thought is that fenced code that is indented/quoted in Markdown should be unindented by the Markdown's indentation level when consumed by Cryptol. So in the Markdown a list item containing some code (using periods for spaces)
should parse as:
Trickier if it's a quoted item with code:
but I'd expect the same parse. Truthfully, I'm not certain whether there's a good answer since Markdowns are mostly ill-defined, but I suppose we have some hope since GitHub Flavored Markdown has a somewhat rigorous definition. |
Looking at the GFM spec, it says
which means we could have:
etc., the first word directing the formatting in markdown and the others being hints to the reader and/or test runner. |
Given that |
I was thinking that Cryptol would parse exactly those fences that started with |
So we want the fence info string to do several things:
Are there others? |
One minor distinction is REPL vs. batch output, e.g. batch mode adds |
@WeeknightMVP could you elaborate on this, I'm not following you. |
@auricratio So of course I don't get the same results running another version of Cryptol... When I run |
...and in the Cryptol version I just built from source today, both the interpreter and batch mode output |
Could someone summarize what we may want to add/change to satisfy this ticket? |
Well, how about we follow Frank’s suggestion:
Then we leave REPL parsing for CI, etc. to be worked out by other tools. This would allow Markdown fences to start with ‘cryptol’ and then include modifiers that other tools could key on. |
@weaversa That's less flexible that what we currently have, and will disallow the use cases I mentioned in #857 (comment) How would you write a literate Cryptol document where you'd like to hide some of the definitions? Isn't a rather simple solution to the original issue to simply use |
🤷 Many of the Cryptol course students were new to Markdown and didn't understand that their were different types of code fences. We had lots of questions about why typing We ended up adding a rather large paragraph at the top of every lab which seems to have fixed the issue the students were having. I'm not opposed to just leaving things as they are. I do think it's worthwhile to explore how to integrate tooling to help catch inconsistent interpreter output (like you said, for the Cryptol book). |
Just now I was trying to put a pre-formatted ascii-art diagram into a literate cryptol markdown file. I had been marking all my cryptol code sections with Fortunately I discovered a workaround, which is to add a meaningless info string to the triple-backtick for the non-cryptol preformatted text. |
@brianhuffman At present we consider a markdown code segment to be Cryptol code if:
The code as written is clearly on purpose (i.e., not an unintentional bug), but I don't have a strong opinion on how it should work as this is not a feature I use a lot: cryptol/src/Cryptol/Parser/Unlit.hs Line 103 in 07c689a
I do kind if like that unspecified code is treated as |
Well, the important thing to me is that I'm able to have a markdown file with some cryptol code blocks and some other preformatted text blocks that are not cryptol. And I can do that, although it wasn't obvious to me at first how to do it. The main action item, I think, is to document the |
@brianhuffman I want this too, for Cryptol and SAW -- GaloisInc/saw-script#1408 |
In 2.8 and 2.9 (at least), triple-backtick followed by
cryptolcheese
and presumably any line starting with triple-backtickcryptol
acts as a fence and code within gets consumed by Cryptol's parser.The text was updated successfully, but these errors were encountered: