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

Add support for parsing polymorphic type declarations #1355

Merged
merged 11 commits into from
Jan 26, 2024
Merged

Conversation

shonfeder
Copy link
Contributor

@shonfeder shonfeder commented Jan 25, 2024

Closes #1296

Adds support for two new kinds in the types IR:

  1. Type abstraction, giving us type-level functions
  2. Type application, giving us type-level function application

Closes #1297

Adds support for parsing polymorphic type declarations and type constructor application. This enables forming types of the kinds above as follows:

  1. Type abstractions is produced only by type declarations of the following form:

    type T[a,b] = (a, b)

    Similar to operator declarations, there are parsed into the assignment of a name to an abstraction. I.e., in this case, T = Λ(a, b).(a,b)

  2. Type application generalizes our current special-cased support for List and Set. E.g., we apply the polymorphic T defined above as T[int, str].

@shonfeder
Copy link
Contributor Author

As is always the case with changes to the parser, nearly all the lines in the diff are from updates to fixtures and the generated parser code.

@shonfeder shonfeder marked this pull request as ready for review January 25, 2024 03:52
Copy link
Collaborator

@bugarela bugarela left a comment

Choose a reason for hiding this comment

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

I can't wait to start using this!
Just left a few comments, specially on the ToIRListener where we should have fallbacks to enable error recovery on this stage of parsing.

quint/package.json Show resolved Hide resolved
quint/src/ir/quintTypes.ts Outdated Show resolved Hide resolved
quint/src/parsing/ToIrListener.ts Show resolved Hide resolved
quint/src/parsing/ToIrListener.ts Show resolved Hide resolved
quint/src/types/base.ts Outdated Show resolved Hide resolved
quint/src/parsing/ToIrListener.ts Outdated Show resolved Hide resolved
Shon Feder and others added 3 commits January 25, 2024 08:38
Co-authored-by: Gabriela Moreira <gabrielamoreira05@gmail.com>
Co-authored-by: Gabriela Moreira <gabrielamoreira05@gmail.com>
@shonfeder shonfeder requested a review from bugarela January 25, 2024 15:33
@shonfeder shonfeder enabled auto-merge January 26, 2024 01:21
@shonfeder shonfeder merged commit dd4a887 into main Jan 26, 2024
15 checks passed
@shonfeder shonfeder deleted the 1073/poly-types branch January 26, 2024 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants