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

Implement Control Flow #152

Open
Ratstail91 opened this issue Nov 13, 2024 · 3 comments
Open

Implement Control Flow #152

Ratstail91 opened this issue Nov 13, 2024 · 3 comments
Labels
feature New feature or request TODO A planned addition urgent this needs addressing immediately

Comments

@Ratstail91
Copy link
Owner

Ratstail91 commented Nov 13, 2024

  • if-then-else
  • ternary ?:
  • while
  • do-while
  • for
  • foreach (compounds)
  • continue
  • break
  • switch-case-default (and continue?)

Potential Opcodes:

  • JUMP
  • JUMP_CONDITIONAL (true/false)

I'm not sure how a switch statement could be done efficiently, so it'll need research.

@Ratstail91 Ratstail91 added feature New feature or request TODO A planned addition labels Nov 13, 2024
@Ratstail91
Copy link
Owner Author

I did some thinking about this yesterday.

https://github.com/Ratstail91/Toy/blob/v2/.notes/control-flow-opcodes.txt

@Ratstail91 Ratstail91 added the urgent this needs addressing immediately label Nov 17, 2024
@Ratstail91
Copy link
Owner Author

Ratstail91 commented Nov 22, 2024

I started working on if-then-else a few days ago, but the tests aren't finished yet due to unrelated bug hunts.

34577ec

Edit: And finished: 0947430

@Ratstail91
Copy link
Owner Author

The control flow for break and continue requires arrays to keep track during compilation, so #155 needs to be finished first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request TODO A planned addition urgent this needs addressing immediately
Projects
None yet
Development

No branches or pull requests

1 participant