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

Draft: Add Else Operator #198

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Conversation

anoojpatel
Copy link

@anoojpatel anoojpatel commented Apr 5, 2024

Add the Else Operator with type: (else): Maybe a -> a -> a

This PR adds a new Else binary operator into the AST and handles the tracking of the Maybe type constructor from the prelude.

  • Extract out Maybe a type from prelude
  • Handle just the Maybe a else b definitions in the AST and Parsing by desugaring into a Match AST
  • Pass Tests

src/cache/mod.rs Outdated Show resolved Hide resolved
src/hir/mod.rs Outdated Show resolved Hide resolved
src/hir/printer.rs Outdated Show resolved Hide resolved
src/nameresolution/builtin.rs Outdated Show resolved Hide resolved
src/nameresolution/mod.rs Outdated Show resolved Hide resolved
src/types/typechecker.rs Outdated Show resolved Hide resolved
src/types/typechecker.rs Outdated Show resolved Hide resolved
src/types/typechecker.rs Outdated Show resolved Hide resolved
src/llvm/mod.rs Outdated Show resolved Hide resolved
src/cranelift_backend/mod.rs Outdated Show resolved Hide resolved
src/cache/mod.rs Outdated Show resolved Hide resolved
src/hir/printer.rs Outdated Show resolved Hide resolved
src/parser/mod.rs Outdated Show resolved Hide resolved
src/cranelift_backend/mod.rs Outdated Show resolved Hide resolved
@jfecher
Copy link
Owner

jfecher commented May 20, 2024

Since this PR has been open for some time, let me know if you want to pair program this together some time, want me to take it over entirely, or if you want to keep working on it solo. I've been rather slow to respond lately so I apologize for slowing things down a bit but your contribution is still very much appreciated 🙂.

@anoojpatel
Copy link
Author

Hi! No worries, and sorry for the slow progress! I'm definitely open to pair program whenever you might be available! I'm hoping to finish this and merge it in

@anoojpatel
Copy link
Author

Thanks for the pairing session! Was a great learning experience and thanks for taking the time out :)

To summarize, things that are left is mainly handling the single line if a then b else c disambiguating by creating a without_else_expr with a boolean value to handle that case in the parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants