Update SlipCompiler.py

This commit is contained in:
Skye Terran 2021-12-09 17:34:49 -08:00
parent bc67e40434
commit f3681a56d1

View File

@ -44,12 +44,12 @@ lit_type = ""
for word in source_code: for word in source_code:
print(f"\nIn: \"{word}\"") print(f"\nIn: \"{word}\"")
# Handle literal types # Handle literal types
if code_type == "lit_type": if code_type == "type":
print("Consuming literal type...") print("Consuming literal type...")
print("Expecting next input to be a literal value.") print("Expecting next input to be a literal value.")
# Consume a literal of this word's type next # Consume a literal of this word's type next
code_type = "literal" code_type = "value"
lit_type = word lit_type = word
# Push the type opcode onto the instruction stack # Push the type opcode onto the instruction stack
@ -58,7 +58,7 @@ for word in source_code:
print(f"Out: {hex(opcode)}") print(f"Out: {hex(opcode)}")
continue continue
# Handle literal values # Handle literal values
if code_type == "literal": if code_type == "value":
print("Consuming literal value...") print("Consuming literal value...")
# Consume a generic command next # Consume a generic command next
@ -85,7 +85,7 @@ for word in source_code:
print("Consuming generic command...") print("Consuming generic command...")
if word == "LIT": if word == "LIT":
print("Expecting next input to be a literal type.") print("Expecting next input to be a literal type.")
code_type = "lit_type" code_type = "type"
opcode = instruction_opcodes[word] opcode = instruction_opcodes[word]
byte_code.append(opcode) byte_code.append(opcode)
print(f"Out: {hex(opcode)}") print(f"Out: {hex(opcode)}")