bf v1.4.0 Bf.Parser View Source
Parses brainfuck programs.
Examples
iex> Bf.Parser.parse("++++[-.]>--")
{:ok, [{:add, 4},
{:loop, [{:add, -1}, {:write}]},
{:move, 1},
{:add, -2}]}
Link to this section Summary
Functions
Parses a brainfuck program into and returns a list of instructions
Link to this section Types
All possible brainfuck instructions.
A list of brainfuck instructions.
Link to this section Functions
Parses a brainfuck program into and returns a list of instructions.
Examples
iex> "--[>--->->->++>-<<<<<-------]>--.>---------.>--..+++."
...> |> Bf.Parser.parse()
{:ok,
[{:add, -2},
{:loop,
[move: 1, add: -3, move: 1, add: -1, move: 1, add: -1,
move: 1, add: 2, move: 1, add: -1, move: -5, add: -7]},
{:move, 1}, {:add, -2}, {:write}, {:move, 1}, {:add, -9},
{:write}, {:move, 1}, {:add, -2}, {:write}, {:write},
{:add, 3}, {:write}]}