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

Feat while statement #24

Merged
merged 2 commits into from Apr 2, 2024
Merged

Feat while statement #24

merged 2 commits into from Apr 2, 2024

Conversation

alexgarzao
Copy link
Owner

This PR supports the while statement in the Pascal parser and code generator. The changes include additions to the JASM struct and methods to handle while statements, modifications to the TreeShapeListener to invoke these methods, and adjustments to the Pascal grammar file to correctly parse while statements. Test files have also been added to ensure the correct functionality.

Key changes include:

Support for while statement in the JASM code generator:

  • codegen/jasm.go: Added whileTestLabel and nextStatementLabel to the JASM struct to handle while statements. Introduced StartWhileStatement, FinishWhileStatement, and StartWhileBlock methods to generate the appropriate JASM code for while statements. [1] [2]

Integration of while statement handling in the TreeShapeListener:

  • codegen/tree_shape_listener.go: Added EnterWhileStatement, ExitWhileStatement, and EnterWhileBlock methods to the TreeShapeListener to invoke the corresponding methods in the JASM struct.

Changes to the Pascal grammar:

  • parser/Pascal.g4: Modified the whileStatement rule to include a whileBlock, and added a new whileBlock rule to correctly parse while statements.

Addition of test files:

@alexgarzao alexgarzao merged commit 2725dcd into main Apr 2, 2024
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.

None yet

1 participant