diff --git a/src/main.py b/src/main.py index 94d3378..8e0c423 100644 --- a/src/main.py +++ b/src/main.py @@ -1,35 +1,10 @@ -from src.isa import ( - Data, - Instruction, - Opcode, - create_data_memory, - create_instructions_memory, - read_data, - read_instructions, - write_data, - write_instructions, -) +from src.translator import translate def start() -> None: - instr = create_instructions_memory( - [ - Instruction(0, Opcode.PUSH, 10), - Instruction(1, Opcode.ADD, 2), - Instruction(2, Opcode.MUL, 1), - Instruction(10, Opcode.POP), - ] - ) - data = create_data_memory( - [ - Data(0, 1), - Data(1, 1), - Data(2, 0), - Data(6, 1), - Data(10, 2), - ] - ) - write_instructions("i.txt", instr) - write_data("d.txt", data) - print(read_instructions("i.txt")) - print(read_data("d.txt")) + with open("./examples/hello_world.asm", encoding="utf-8") as f: + source = f.read() + + instr, data = translate(source) + print(instr) + print(data)