-
Notifications
You must be signed in to change notification settings - Fork 235
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
Frontend support for language extension with #lang-X #3363
Merged
Merged
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0682aaf
changes in preparation for #lang-<ext>
nikswamy 6879011
Merge remote-tracking branch 'origin/master' into nik_use_lang
nikswamy c9cba30
supporting for #lang-X, with some unit tests; also works for #lang-pulse
nikswamy c78bdc4
Merge remote-tracking branch 'origin/master' into nik_use_lang
nikswamy 6b97853
support for detecting the current file in the IDE, and an Unparseable…
nikswamy b4b804a
allow desugared blobs to be compared with a callback
nikswamy 5b32f96
support for syntax extension to offer their own dependence scanning
nikswamy a7b9123
remove dump module in parser.driver (debugging)
nikswamy 1edff2f
mistakenly commented out some unit tests
nikswamy 648d685
snap
nikswamy 7c1bc74
backwards compat for fstar-mode.el use of Push operations in ide mode…
nikswamy afe6ca4
stashing open namespaces and module abbrevs in the repl_lang state fo…
nikswamy efad29a
Merge remote-tracking branch 'origin/master' into nik_use_lang
nikswamy fe1e92e
remove stray debugging message
nikswamy fa29b7d
exporting parser productons for decls with and without decorations
nikswamy f84799b
simplifying desugaring of extension code, passing desugaring environm…
nikswamy 53d4a50
fix interleaving splices; fix handling of typeclass decorations
nikswamy 3e1a61c
remove explicit passing of open namespaces to extension_lang parsers;…
nikswamy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What do you think about ending an extension block with
#lang-fstar
(or#lang-pulse
for that matter)?I wonder if it is feasible for the extension parser/lexer to call back into the main parser. That is, if we could just add a
#lang-
rule to the pulse grammer?One disadvantage of detecting the end of the extension block here is that it is unaware of the lexical syntax of the extension language (namely string literals and comments).
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.
Or an optional #end-lang-X to match a #lang-X?
The extension parser for Pulse does call back into the F* parser and lexer. So, it can, in principle, handle a nested
#lang-x ... #end-lang-x
blockThe disadvantage you mentioned remains, but I guess it's not so bad ... you should be aware of the placement of the end-lang block.
That said, for Pulse itself, I don't see any reason to actually end the #lang-pulse block. Do you?
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.
What I'm suggesting is that
#lang-foo
means "parse the rest of the file using Foo." And then the parser for Foo could have the same command, calling back to the main parser.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.
Right, this works. You can even do
And it will recursively call back into the Pulse parser for the second block
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 also registered an #lang-fstar parser and removed #end-lang