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 If Statements #4

Closed
8 tasks done
mrodz opened this issue Mar 18, 2023 · 1 comment · Fixed by #6
Closed
8 tasks done

Bytecode If Statements #4

mrodz opened this issue Mar 18, 2023 · 1 comment · Fixed by #6
Labels
bytecode Issues related to bytecode enhancement New feature or request instruction Bytecode instruction need-documentation This issue introduces a new feature that requires fresh documentation
Milestone

Comments

@mrodz
Copy link
Owner

mrodz commented Mar 18, 2023

Spec

if (>=1)

  • Should look at the last item on the local stack
  • Check if it is boolean
  • Send a signal to the interpreter that informs it whether the evaluation proved truthy.
  • Clear the local operating stack.

else

  • If the condition is not true, this code is ran.
  • Error if this is encountered outside of an if-statement.

endif

  • Close this if-statement.
  • Clear the local operating stack.
function main
    bool true
    if
        string "hi"
        printn *
    else
        string "awww"
        printn *
    endif
end

Concerns

This is unoptimized and there is much room for improvement.

@mrodz mrodz mentioned this issue Mar 18, 2023
44 tasks
@mrodz mrodz changed the title "cmp" instruction If Statements Mar 20, 2023
@mrodz
Copy link
Owner Author

mrodz commented Mar 20, 2023

Make separate issue for comparisons.

@mrodz mrodz changed the title If Statements Bytecode If Statements Mar 20, 2023
@mrodz mrodz added enhancement New feature or request bytecode Issues related to bytecode labels Mar 20, 2023
@mrodz mrodz closed this as completed in #6 Mar 23, 2023
@mrodz mrodz added need-documentation This issue introduces a new feature that requires fresh documentation instruction Bytecode instruction labels Mar 23, 2023
@mrodz mrodz added this to the Bytecode milestone Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bytecode Issues related to bytecode enhancement New feature or request instruction Bytecode instruction need-documentation This issue introduces a new feature that requires fresh documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant