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 for loop #1

Open
2 of 4 tasks
PoetaKodu opened this issue Apr 26, 2022 · 2 comments
Open
2 of 4 tasks

Add for loop #1

PoetaKodu opened this issue Apr 26, 2022 · 2 comments
Assignees

Comments

@PoetaKodu
Copy link
Collaborator

PoetaKodu commented Apr 26, 2022

Status

Currently waiting for templates and concepts implementation to implement range-for

Checklist

  • Parsing of the default form for (init; cond; iter) body
  • Execution of the default form
  • Parsing of the range-for
  • Execution of the range-for

Default for

for (var i = 0; i < arr.size(); i += 1) {
    // body
}

general form:

for ( init-statement condition; iteration-statement) {
    // body
}

Range-for

for (elem of arr) {
    // elem is immutable copy of each arr element
}

general form:

for (variable-def-no-init of range) {

}
for (variable-name in indexed-range) {
    // variable-name is a key of each element in the indexed-range
    // indexed-range[variable-name] is a valid reference or value inside the range
}

// TODO: support for number range

@Dich0tomy
Copy link
Collaborator

General for statement grammar done.
Now I'm trying to implement it in the VM so that we can actually see some effect on the screen.

@Dich0tomy
Copy link
Collaborator

The general for loop form is implemented in the VM and it seems to work.
No bugs have been reported, no issues have been found.

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

No branches or pull requests

2 participants