mirror of
https://github.com/russolsen/sallyforth
synced 2024-11-16 19:48:49 +01:00
Handle short circuit boolean operators correctly.
This commit is contained in:
parent
6c67d2350f
commit
4c03ea5388
1 changed files with 6 additions and 2 deletions
|
@ -56,11 +56,15 @@ def div(forth):
|
|||
|
||||
@word('and')
|
||||
def w_and(forth):
|
||||
forth.stack.push(forth.stack.pop() and forth.stack.pop())
|
||||
a = forth.stack.pop()
|
||||
b = forth.stack.pop()
|
||||
forth.stack.push(a and b)
|
||||
|
||||
@word('or')
|
||||
def w_or(forth):
|
||||
forth.stack.push(forth.stack.pop() or forth.stack.pop())
|
||||
a = forth.stack.pop()
|
||||
b = forth.stack.pop()
|
||||
forth.stack.push(a or b)
|
||||
|
||||
@word('not')
|
||||
def w_not(forth):
|
||||
|
|
Loading…
Reference in a new issue