diff --git a/README.md b/README.md index 85c795e..d61943c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ Execute the IPEL code by navigating to the repository folder and running `interp ``` $ python3 interpreter.py [options] (codeFile | code) ``` +or +``` +$ ./interpreter.py [options] (codeFile | code) +``` `codeFile` is any file that contains IPEL code. `code` is a string that contains IPEL code. diff --git a/src/evaluator.py b/src/evaluator.py index d7f57f9..eb243e6 100644 --- a/src/evaluator.py +++ b/src/evaluator.py @@ -66,13 +66,15 @@ def evaluate(lex, lab, debugmode, unvoiced, voiced, executionStack, currentStack elif type(con) in [list]: truthy = con != [] ep += 1 if truthy else 0 - # loop index getters and setters - elif lex[ep].lexeme == "e": - if numLoops > 0: + # loop index and limit getters and setters + elif lex[ep].lexeme == "e" and len(executionStack) > 0: currentStack.append(executionStack[-1]) - elif lex[ep].lexeme == "ø": - if numLoops > 0: + elif lex[ep].lexeme == "ø" and len(executionStack) > 0: executionStack[-1] = currentStack.pop() + elif lex[ep].lexeme == "æ" and len(executionStack) > 1: + currentStack.append(executionStack[-2]) + elif lex[ep].lexeme == "œ" and len(executionStack) > 1: + executionStack[-2] = currentStack.pop() # voicing elif lex[ep].lexeme == "ɸ": currentStack = unvoiced diff --git a/src/util.py b/src/util.py index 7acbbe0..c63d39d 100644 --- a/src/util.py +++ b/src/util.py @@ -92,4 +92,4 @@ def convert_base(s, base=10): integer = digits[i[1]] if integer >= base: raise ValueError ret += base**-(i[0] + 1) * integer - return ret + return ret \ No newline at end of file