WR54VAZ4RTED4MF5ZGOJMD437TFGFYLZF5YLU5KEZVCMMUD7WNMAC
, # read a byte
[ # if it's null, exit
. # otherwise emit it
, # read next byte
] # loop
[->+<]
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp)
function eval()
print(cp, #code)
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[', cp)
end
elseif inst == '.' then
print(string.char(data[dp]))
--? print(data[dp])
elseif inst == ',' then
data[dp] = string.byte(io.read(1))
elseif inst == '#' then
cp = code:find('\n', cp)
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[', cp)
end
elseif inst == '.' then
--? print(string.char(data[dp]))
print(data[dp])
elseif inst == ',' then
data[dp] = string.byte(io.read(1))
elseif inst == '#' then
cp = code:find('\n', cp)
cp = cp+1
end
end
print(#arg)
if #arg > 0 then
print(arg[1])
local f = io.open(arg[1])
if f == nil then
print('could not open', arg[1])
os.exit(1)
{"fw_app":"bf","In":98,"draw_title":110,"Out":103,"on.keychord_press":122,"Num_panels_horizontal":23,"on.text_input":118,"Num_panels_vertical":24,"editor_to_string":121,"on.initialize":104,"create_editor_panel":114,"Margin":27,"Title_font":73,"Data":102,"map":123,"create_editor":94,"Font_size":28,"Code":101,"Data_title_text":76,"on":1,"panel_bounds":93,"draw_data":90,"on.mouse_press":112,"eval":136,"on.draw":108,"Cursor":38,"fw_parent":135,"draw_editor_panel":109}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
print('== inst', cp, #code)
print('-- data')
for i,d in ipairs(Data) do
print(i,d)
end
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
if #In.editor.lines[1].data > 0 then
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
else
data[dp] = 0
end
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"create_editor":94,"Title_font":73,"Code":101,"on.keychord_press":122,"In":98,"on.text_input":118,"Out":103,"Data_title_text":76,"create_editor_panel":114,"draw_editor_panel":109,"Cursor":38,"Num_panels_vertical":24,"eval":135,"Data":102,"on":1,"fw_parent":134,"draw_title":110,"Num_panels_horizontal":23,"fw_app":"bf","on.mouse_press":112,"on.draw":108,"on.initialize":104,"draw_data":90,"panel_bounds":93,"Margin":27,"editor_to_string":121,"Font_size":28,"map":123}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
print('== inst', cp, #code)
print('-- data')
for i,d in ipairs(Data) do
print(i,d)
end
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
print('out')
print(dp, data[dp])
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print('in')
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
if #In.editor.lines[1].data > 0 then
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
else
data[dp] = 0
end
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":134,"Num_panels_horizontal":23,"fw_parent":133,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
print('== inst', cp, #code)
print('-- data')
for i,d in ipairs(Data) do
print(i,d)
end
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
print('out')
print(dp, data[dp])
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print('in')
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":133,"Num_panels_horizontal":23,"fw_parent":132,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
print('== inst', cp, #code)
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
print('out')
print(dp, data[dp])
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print('in')
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":132,"Num_panels_horizontal":23,"fw_parent":131,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
print('== inst', cp)
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
print('out')
print(dp, data[dp])
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print('in')
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":131,"Num_panels_horizontal":23,"fw_parent":130,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
print('out')
print(dp, data[dp])
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print('in')
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":130,"Num_panels_horizontal":23,"fw_parent":129,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
data[dp] = string.byte(In.editor.lines[1].data:sub(1,1))
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":129,"Num_panels_horizontal":23,"fw_parent":128,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print(In)
print(In.editor)
print(In.editor.lines[1].data)
print(In.editor.lines[1].data[1])
data[dp] = string.byte(In.editor.lines[1].data[1])
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":128,"Num_panels_horizontal":23,"fw_parent":127,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
print(In)
print(In.editor)
print(In.editor.lines[1].data)
data[dp] = string.byte(In.editor.lines[1].data[1])
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":127,"Num_panels_horizontal":23,"fw_parent":126,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
data[dp] = string.byte(In.editor.lines[1].data[1])
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"eval":126,"Num_panels_horizontal":23,"fw_parent":125,"draw_title":110,"fw_app":"bf","on":1,"draw_data":90,"Margin":27,"panel_bounds":93,"editor_to_string":121,"on.mouse_press":112,"create_editor":94,"map":123,"Code":101,"Cursor":38,"Title_font":73,"on.draw":108,"Out":103,"In":98,"Font_size":28,"on.keychord_press":122,"Data_title_text":76,"on.text_input":118,"Data":102,"Num_panels_vertical":24,"on.initialize":104,"draw_editor_panel":109,"create_editor_panel":114}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
Out.editor.lines[1].data = Out.editor.lines[1].data..string.char(data[dp])
Text.redraw_all(Out.editor)
--print(string.char(data[dp]))
--print(data[dp])
elseif inst == ',' then
--data[dp] = string.byte(io.read(1))
data[dp] = In.editor.lines[1].data[1]
In.editor.lines[1].data = In.editor.lines[1].data:sub(2)
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"draw_editor_panel":109,"fw_parent":124,"fw_app":"bf","map":123,"draw_title":110,"panel_bounds":93,"eval":125,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"editor_to_string":121,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":122,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[' , cp, --[[plain]] true)
end
elseif inst == '.' then
--print(string.char(data[dp]))
print(data[dp])
elseif inst == ',' then
data[dp] = string.byte(io.read(1))
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
{"draw_editor_panel":109,"fw_parent":123,"fw_app":"bf","map":123,"draw_title":110,"panel_bounds":93,"eval":124,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"editor_to_string":121,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":122,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp, --[[plain]] true)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[', cp)
end
elseif inst == '.' then
--print(string.char(data[dp]))
print(data[dp])
elseif inst == ',' then
data[dp] = string.byte(io.read(1))
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
map = function(arr, f)
local result = {}
for _, x in ipairs(arr) do
table.insert(result, f(x))
end
return result
end
{"draw_editor_panel":109,"fw_parent":122,"fw_app":"bf","map":123,"draw_title":110,"panel_bounds":93,"eval":120,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"editor_to_string":121,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":122,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
on.keychord_press = function(chord, key)
if chord == 'f4' then
eval(editor_to_string(Code.editor), Data)
elseif Cursor then
edit.keychord_press(Cursor.editor, chord, key)
end
end
{"draw_editor_panel":109,"fw_parent":121,"fw_app":"bf","draw_title":110,"panel_bounds":93,"eval":120,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"editor_to_string":121,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":122,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
{"draw_editor_panel":109,"fw_parent":120,"fw_app":"bf","draw_title":110,"panel_bounds":93,"eval":120,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"editor_to_string":121,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":119,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
editor_to_string = function(editor)
return table.concat(map(editor.lines, function(line) return line.data end), '\n')
end
{"draw_editor_panel":109,"fw_parent":119,"fw_app":"bf","draw_title":110,"eval":120,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"panel_bounds":93,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":119,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
eval = function(code, data)
local cp,dp = 1,1
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[', cp)
end
elseif inst == '.' then
--print(string.char(data[dp]))
print(data[dp])
elseif inst == ',' then
data[dp] = string.byte(io.read(1))
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
end
on.keychord_press = function(chord, key)
if Cursor then
edit.keychord_press(Cursor.editor, chord, key)
end
end
{"draw_editor_panel":109,"fw_parent":118,"fw_app":"bf","draw_title":110,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"panel_bounds":93,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":119,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}
on.text_input = function(t)
if Cursor then
edit.text_input(Cursor.editor, t)
end
end
{"draw_editor_panel":109,"fw_parent":117,"fw_app":"bf","draw_title":110,"Num_panels_horizontal":23,"on":1,"Num_panels_vertical":24,"on.text_input":118,"on.initialize":104,"draw_data":90,"panel_bounds":93,"Margin":27,"create_editor_panel":114,"Font_size":28,"on.draw":108,"Title_font":73,"create_editor":94,"Data":102,"Code":101,"on.keychord_press":65,"In":98,"Data_title_text":76,"Out":103,"Cursor":38,"on.mouse_press":112}