Repl.stdio constructor

Repl.stdio()

Creates a REPL wired to stdin and stdout.

Input lines come from stdin via stdin.readLineSync, executed programs use a StdioBrainfuckIO for , and ., and prompts and error messages go to stdout. The CLI uses this.

Lines are read with stdin.readLineSync rather than the async stdin stream because the async stream does not reliably detect end of input from a terminal Ctrl-D, while the synchronous read does. The async* generator still yields one line at a time so the loop can execute each program before reading the next.

Implementation

factory Repl.stdio() => Repl(
  lines: _stdioLines(),
  io: const StdioBrainfuckIO(),
  out: stdout,
);