WR54VAZ4RTED4MF5ZGOJMD437TFGFYLZF5YLU5KEZVCMMUD7WNMAC , # read a byte[ # if it's null, exit. # otherwise emit it, # read next byte] # loop
[->+<]
while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp)
function eval()print(cp, #code)while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[', cp)endelseif inst == '.' thenprint(string.char(data[dp]))--? print(data[dp])elseif inst == ',' thendata[dp] = string.byte(io.read(1))elseif inst == '#' thencp = code:find('\n', cp)
elseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[', cp)endelseif inst == '.' then--? print(string.char(data[dp]))print(data[dp])elseif inst == ',' thendata[dp] = string.byte(io.read(1))elseif inst == '#' thencp = code:find('\n', cp)
cp = cp+1endendprint(#arg)if #arg > 0 thenprint(arg[1])local f = io.open(arg[1])if f == nil thenprint('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,1while cp <= #code doprint('== inst', cp, #code)print('-- data')for i,d in ipairs(Data) doprint(i,d)endlocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenOut.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 thendata[dp] = string.byte(In.editor.lines[1].data:sub(1,1))elsedata[dp] = 0endIn.editor.lines[1].data = In.editor.lines[1].data:sub(2)elseif inst == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code doprint('== inst', cp, #code)print('-- data')for i,d in ipairs(Data) doprint(i,d)endlocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenprint('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 thendata[dp] = string.byte(In.editor.lines[1].data:sub(1,1))elsedata[dp] = 0endIn.editor.lines[1].data = In.editor.lines[1].data:sub(2)elseif inst == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code doprint('== inst', cp, #code)print('-- data')for i,d in ipairs(Data) doprint(i,d)endlocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenprint('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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code doprint('== inst', cp, #code)local inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenprint('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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code doprint('== inst', cp)local inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenprint('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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenprint('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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenOut.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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenOut.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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenOut.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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenOut.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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' thenOut.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 == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[' , cp, --[[plain]] true)endelseif inst == '.' then--print(string.char(data[dp]))print(data[dp])elseif inst == ',' thendata[dp] = string.byte(io.read(1))elseif inst == '#' thencp = code:find('\n', cp)endcp = cp+1endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp, --[[plain]] true)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[', cp)endelseif inst == '.' then--print(string.char(data[dp]))print(data[dp])elseif inst == ',' thendata[dp] = string.byte(io.read(1))elseif inst == '#' thencp = code:find('\n', cp)endcp = cp+1endend
map = function(arr, f)local result = {}for _, x in ipairs(arr) dotable.insert(result, f(x))endreturn resultend
{"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' theneval(editor_to_string(Code.editor), Data)elseif Cursor thenedit.keychord_press(Cursor.editor, chord, key)endend
{"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,1while cp <= #code dolocal inst = code:sub(cp,cp)if inst == '<' thendp = dp-1elseif inst == '>' thendp = dp+1elseif inst == '+' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]+1elseif inst == '-' thenif data[dp] == nil then data[dp] = 0 enddata[dp] = data[dp]-1elseif inst == '[' thenif data[dp] == 0 thencp = code:find(']', cp)endelseif inst == ']' thenif data[dp] ~= 0 thencp = rfind(code, '[', cp)endelseif inst == '.' then--print(string.char(data[dp]))print(data[dp])elseif inst == ',' thendata[dp] = string.byte(io.read(1))elseif inst == '#' thencp = code:find('\n', cp)endcp = cp+1endend
on.keychord_press = function(chord, key)if Cursor thenedit.keychord_press(Cursor.editor, chord, key)endend
{"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 thenedit.text_input(Cursor.editor, t)endend
{"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}