45 case '>' => (pc + 1, mp + 1, mem) |
45 case '>' => (pc + 1, mp + 1, mem) |
46 case '<' => (pc + 1, mp - 1, mem) |
46 case '<' => (pc + 1, mp - 1, mem) |
47 case '+' => (pc + 1, mp, write(mem, mp, sread(mem, mp) + 1)) |
47 case '+' => (pc + 1, mp, write(mem, mp, sread(mem, mp) + 1)) |
48 case '-' => (pc + 1, mp, write(mem, mp, sread(mem, mp) - 1)) |
48 case '-' => (pc + 1, mp, write(mem, mp, sread(mem, mp) - 1)) |
49 case '.' => { print(sread(mem, mp).toChar); (pc + 1, mp, mem) } |
49 case '.' => { print(sread(mem, mp).toChar); (pc + 1, mp, mem) } |
50 case ',' => (pc + 1, mp, write(mem, mp, Console.in.read().toByte)) |
50 case ',' => (pc + 1, mp, write(mem, mp, Console.in.read().toByte)) //scala.io.StdIn.readLine() |
51 case '[' => if (sread(mem, mp) == 0) |
51 case '[' => if (sread(mem, mp) == 0) |
52 (jumpRight(prog, pc + 1, 0), mp, mem) |
52 (jumpRight(prog, pc + 1, 0), mp, mem) |
53 else (pc + 1, mp, mem) |
53 else (pc + 1, mp, mem) |
54 case ']' => if (sread(mem, mp) != 0) |
54 case ']' => if (sread(mem, mp) != 0) |
55 (jumpLeft(prog, pc - 1, 0), mp, mem) |
55 (jumpLeft(prog, pc - 1, 0), mp, mem) |