require "./*" module Brainfuck DEFAULT_TAPE_SIZE = 30_000 enum Opcode PtrRight PtrLeft Inc Dec Out In LoopStart LoopEnd end def self.opcode_from_char(c : Char) : Opcode? case c when '>' then Opcode::PtrRight when '<' then Opcode::PtrLeft when '+' then Opcode::Inc when '-' then Opcode::Dec when '.' then Opcode::Out when ',' then Opcode::In when '[' then Opcode::LoopStart when ']' then Opcode::LoopEnd else nil end end end