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

Parse record declaration while declaring variable #178

Merged
merged 3 commits into from
Oct 19, 2024

Conversation

leewei05
Copy link
Contributor

Current parser only support type declaration and variable declaration separately. With this update, users can declare both custom type and variable at the same type. Example,

struct animal {
  int lion;
  int tiger;
  int giraffe;
} big_zoo = {
  .lion = 10,
  .tiger = 8,
  .giraffe = 12,
};

Noting that I added a set for tracking custom types, so that the compiler doesn't dump type declaration every time a custom type is used.

@leewei05 leewei05 self-assigned this Oct 18, 2024
@leewei05 leewei05 mentioned this pull request Oct 18, 2024
13 tasks
@leewei05 leewei05 requested a review from Lai-YT October 18, 2024 17:45
Copy link
Collaborator

@Lai-YT Lai-YT left a comment

Choose a reason for hiding this comment

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

COOL 😎

parser.y Outdated Show resolved Hide resolved
parser.y Outdated Show resolved Hide resolved
parser.y Show resolved Hide resolved
test/typecheck/union.c Outdated Show resolved Hide resolved
@leewei05 leewei05 requested a review from Lai-YT October 19, 2024 05:11
@leewei05
Copy link
Contributor Author

Added code generation tests since this doesn't require additional code generation implementations.

parser.y Show resolved Hide resolved
test/typecheck/union.c Outdated Show resolved Hide resolved
@leewei05 leewei05 requested a review from Lai-YT October 19, 2024 05:49
Copy link
Collaborator

@Lai-YT Lai-YT left a comment

Choose a reason for hiding this comment

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

LGTM!

@Lai-YT Lai-YT merged commit c1c13be into fruits-lab:main Oct 19, 2024
8 checks passed
@leewei05 leewei05 deleted the record-designators branch October 19, 2024 05:51
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