Skip to content
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

Fixing strange parses #117

Merged
merged 10 commits into from
Oct 19, 2023
Merged

Fixing strange parses #117

merged 10 commits into from
Oct 19, 2023

Conversation

jaredponn
Copy link
Collaborator

@jaredponn jaredponn commented Oct 17, 2023

In light of issue #116, this fixes some of the strange somewhat nonintuitive parses.

High level overview of changes

  • This proposes a more structured way of handling whitespace with parsec. The key idea is to maintain the invariant that all parsers begin at a non whitespace token.
  • We maintain the invariant by ensuring that the initial parser skips whitespace / comments, and every "token" eats up whitespace/comments after it finishes parsing the token.
  • The structure of parsing lead to changes in the test suite where we had lots of test cases which had "invalid" whitespace at the beginning. This structure makes these tests no longer relevant.
  • I also included a specification of the syntactic forms of a lambda buffer file.

@jaredponn jaredponn changed the title Jared/116 strange parses #116 strange parses Oct 17, 2023
@jaredponn jaredponn changed the title #116 strange parses Fixing strange parses Oct 17, 2023
@jaredponn jaredponn linked an issue Oct 17, 2023 that may be closed by this pull request
@jaredponn jaredponn force-pushed the jared/116-strange-parses branch 4 times, most recently from 29d7d4d to f2fb0fd Compare October 17, 2023 17:53
@jaredponn jaredponn self-assigned this Oct 18, 2023
@jaredponn jaredponn added frontend invalid This doesn't seem right labels Oct 18, 2023
Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaredponn thank you so much! this is incredible work and I learned a lot.

This is pure gold.

The only thing I want you to do is to extract that big comment about the syntax and put it in a chapter.

@jaredponn jaredponn force-pushed the jared/116-strange-parses branch 2 times, most recently from d45b655 to f7c4519 Compare October 19, 2023 05:36
_typos.toml Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
@jaredponn
Copy link
Collaborator Author

Thank you @bladyjoker for the feedback, it's very appreciated.

As requested, I wrote a quick chapter over here.

@jaredponn jaredponn force-pushed the jared/116-strange-parses branch from f7c4519 to e697b61 Compare October 19, 2023 06:06
@jaredponn jaredponn requested a review from bladyjoker October 19, 2023 06:15
Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very lovely documentation! Left some comments for you to attend to, but feel free to merge this at your leisure. We will definitely iterate on this chapter some more so no need to get it perfect the first time around.

docs/SUMMARY.md Outdated Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
docs/syntax.md Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
docs/syntax.md Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
docs/syntax.md Outdated Show resolved Hide resolved
jared added 5 commits October 19, 2023 15:40
- Uniform handling of whitespace

- Added a syntactic specification in the comments

- Updated test suite to reflect the changes
- Changed parsing test case to no longer use keywords as a field name (as per the specification)

- Improved `LambdaBuffers/Frontend/Parsec.hs` documentation

- Updated TODO in `Test/LambdaBuffers/Frontend/Parsec.hs`

- Fixed `LambdaBuffers/Frontend/Parsec.hs` incorrectly parsing `:--`
jared added 5 commits October 19, 2023 15:40
- Fixed strange whitespace (added whitespace after headers / put
  paragraphs in a single line)

- Changed `long` to `modulealias`

- General wording improvements + fixed error in `opaque` type defn.
@jaredponn
Copy link
Collaborator Author

Thanks again for the feedback -- it was really helpful! #119 #120 will track the remaining issues.

I'll rebase this and merge it now.

@jaredponn jaredponn force-pushed the jared/116-strange-parses branch from 05f0e44 to 72086d2 Compare October 19, 2023 21:41
@jaredponn jaredponn added this pull request to the merge queue Oct 19, 2023
Merged via the queue into main with commit c1e5a31 Oct 19, 2023
@jaredponn jaredponn deleted the jared/116-strange-parses branch October 19, 2023 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend invalid This doesn't seem right
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Strange Parses
2 participants