QKINOUCX22BZWA3VONV4J3KKR63EOVNJAGUUNXKGRHGHLPD7R77QC
src := read_file("./math.txt")
tokens := lex.lex(src)
when DEBUG {
lex.print_ast(tokens)
fmt.println("========")
}
ast := shuntingyard.shunting_yard(tokens)
when DEBUG {
lex.print_ast(ast)
for {
inp_buf := make([dynamic]byte, 256)
defer delete(inp_buf)
fmt.print("> ")
char_count, err := os.read(os.stdin, inp_buf[:])
if err < 0 {
fmt.println("[!] ERROR", err)
return
}
// Remove new line
src := string(inp_buf[:char_count - 1])
// src := read_file("./math.txt")
tokens := lex.lex(src)
when DEBUG {
lex.print_ast(tokens)
fmt.println("========")
}
ast := shuntingyard.shunting_yard(tokens)
when DEBUG {
lex.print_ast(ast)
}
my_vm := vm.new_vm(ast[:])
defer vm.delete_vm(my_vm)
res := vm.execute(my_vm)
fmt.println(res)