Skip to content

Commit

Permalink
small changes, int division axed
Browse files Browse the repository at this point in the history
  • Loading branch information
bigyihsuan committed Jun 16, 2020
1 parent 3fe5897 commit b2d7313
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def evaluate(lex, lab, debugmode, unvoiced, voiced, executionStack, currentStack
if lex[ep].lexeme == "ʟ": # Unconditional jump
ep = lab[lex[ep+1].lexeme]
elif lex[ep].lexeme == "ʌ": # Conditional skip
ep += 1 if currentStack.pop() else 0
ele = currentStack.pop()
truthy = ele != 0 or ele != "" or ele != []
ep += 1 if truthy else 0
# loop index getters and setters
elif lex[ep].lexeme == "e":
if numLoops > 0:
Expand Down
5 changes: 1 addition & 4 deletions src/instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ def executeInstruction(instruction, unvoiced, voiced, currentStack):
if type(currentStack[-1]) in [int,float] and type(currentStack[-2]) in [int,float]:
b = currentStack.pop()
a = currentStack.pop()
if type(a) == int and type(b) == int:
quotient = a // b if b != 0 else 0
else:
quotient = a / b if b != 0 else 0
quotient = a / b if b != 0 else 0
currentStack.append(quotient)
elif instruction == "ⱱ":
if type(currentStack[-1]) in [int,float] and type(currentStack[-2]) in [int,float]:
Expand Down

0 comments on commit b2d7313

Please sign in to comment.