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

bytecode: Implement while and break statements #324

Merged
merged 1 commit into from
Apr 7, 2024
Merged

Conversation

Rossiar
Copy link
Collaborator

@Rossiar Rossiar commented Apr 4, 2024

The bytecode for a while statement is similar to that produced for
an if, except that the OpJump points to the start of the
statement and not the end. Break statements are also jumps to
the end of their enclosing loop.

pkg/bytecode/compiler.go Outdated Show resolved Hide resolved
pkg/bytecode/compiler.go Outdated Show resolved Hide resolved
pkg/bytecode/compiler.go Outdated Show resolved Hide resolved
pkg/bytecode/compiler.go Outdated Show resolved Hide resolved
pkg/bytecode/compiler.go Outdated Show resolved Hide resolved
pkg/bytecode/compiler.go Outdated Show resolved Hide resolved
pkg/bytecode/vm_test.go Outdated Show resolved Hide resolved
The bytecode for a while statement is similar to that produced for
an `if`, except that the OpJump points to the start of the
statement and not the end. Break statements are also jumps to
the end of their enclosing loop.

Co-authored-by: joshcarp <joshcarp@users.noreply.github.com>
Co-authored-by: pgmitche <pgmitche@users.noreply.github.com>
@camh- camh- merged commit 89bb7c1 into main Apr 7, 2024
3 checks passed
@camh- camh- deleted the compiler-while branch April 7, 2024 00:22
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