package repl import "../lexer" import "../token" import "core:bufio" import "core:fmt" import "core:io" PROMPT :: ">> " start :: proc(r: io.Reader, w: io.Writer) { s := bufio.scanner_init(&bufio.Scanner{}, r) defer bufio.scanner_destroy(s) for { fmt.wprintf(w, PROMPT) scanned := bufio.scan(s) if !scanned { return } line := bufio.scanner_text(s) l := lexer.new(line) eof: token.EOF for tok := lexer.next_token(&l); tok != eof; tok = lexer.next_token(&l) { fmt.wprintf(w, "%v\n", tok) } } }