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: add ForCountLoopExpr class #141

Merged
merged 7 commits into from
Nov 15, 2024
Merged

Conversation

apkrelling
Copy link
Contributor

@apkrelling apkrelling commented Nov 15, 2024

Pull Request description

This PR adds the ForCountLoopExpr class. This is an attempt to solve #95 .

How to test these changes

from astx.blocks import Block
from astx.datatypes import Int32, LiteralInt32
from astx.flows import ForCountLoopExpr
from astx.operators import BinaryOp, UnaryOp
from astx.variables import InlineVariableDeclaration, Variable

decl_a = InlineVariableDeclaration("a", type_=Int32, value=LiteralInt32(0))
var_a = Variable("a")
cond = BinaryOp(op_code="<", lhs=var_a, rhs=LiteralInt32(10))
update = UnaryOp(op_code="++", operand=var_a)
body = Block()
body.append(LiteralInt32(2))
for_expr = ForCountLoopExpr(
initializer=decl_a, condition=cond, update=update, body=body)
for_expr

for_count_expr

for_count_expr_png

Pull Request checklists

This PR is a:

  • bug-fix
  • new feature
  • maintenance

About this PR:

  • it includes tests.
  • the tests are executed on CI.
  • the tests generate log file(s) (path).
  • pre-commit hooks were executed locally.
  • this PR requires a project documentation update.

Author's checklist:

  • I have reviewed the changes and it contains no misspelling.
  • The code is well commented, especially in the parts that contain more
    complexity.
  • New and old tests passed locally.

Additional information

Note that there is no transpiler visit method for this class, just like for ForCountLoopStmt.

Reviewer's checklist

Copy and paste this template for your review's note:

## Reviewer's Checklist

- [ ] I managed to reproduce the problem locally from the `main` branch
- [ ] I managed to test the new changes locally
- [ ] I confirm that the issues mentioned were fixed/resolved .

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

src/astx/base.py Outdated Show resolved Hide resolved
@xmnlab xmnlab merged commit 0bdebdd into arxlang:main Nov 15, 2024
11 of 12 checks passed
@xmnlab
Copy link
Contributor

xmnlab commented Nov 15, 2024

thanks @apkrelling !

Copy link

🎉 This PR is included in version 0.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants