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 arithmetic expression and if else statement #12

Merged
merged 22 commits into from
Oct 23, 2023
Merged

Conversation

1001mei
Copy link
Contributor

@1001mei 1001mei commented Oct 18, 2023

  • Add compiler support for followings (unless otherwise stated, all applicable only to int type):
    • local variable declaration
    • arithmetic expression involving only binary operators
    • println method that takes String or int type argument
    • (nested) if else statements
    • while and do while loops
    • for loop with the form for (init; cond; update) {}
    • condition expression involved in if/else if/while/for can only have int or boolean literal, and can support all logical operators except logical not (!)
  • Tests will be added in another PR to avoid huge PR and ease process of reviewing

Copy link
Contributor

@Chang-CH Chang-CH left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@xyliew25 xyliew25 left a comment

Choose a reason for hiding this comment

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

Gave some thoughts regarding the AST types with reference to previous discussions.

Copy link
Contributor

@xyliew25 xyliew25 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, LGTM!

@1001mei 1001mei merged commit e33afaa into main Oct 23, 2023
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.

4 participants