Last active
November 12, 2022 19:34
-
-
Save WheretIB/aced2e6811eb9d5d3cf54ac6005391a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function seachRepeats(str: string, off: number, symbolToCheck: string) | |
local count = 0 | |
while str:sub(off, off) == symbolToCheck do | |
count += 1 | |
off += 1 | |
end | |
return count | |
end | |
local function generateFunction(code) | |
local seqStr = code | |
local blkArr : {{string}} = {} | |
table.insert(blkArr, "") | |
blkArr[1] ..= "local out = ''\n" | |
blkArr[1] ..= "local tapePos = 1\n" | |
blkArr[1] ..= "local tape = table.create(1000000, 0)\n" | |
local cyclePatternChecker: string = "" | |
local count | |
local i = 1 | |
while i <= #seqStr do | |
local sym = seqStr:sub(i, i) | |
if sym == '+' then | |
count = seachRepeats(seqStr, i, '+') | |
cyclePatternChecker ..= string.rep('+', count) | |
blkArr[#blkArr] ..= "tape[tapePos] += " .. count .. "\n" | |
i += count - 1 | |
elseif sym == '-' then | |
count = seachRepeats(seqStr, i, '-') | |
cyclePatternChecker ..= string.rep('-', count) | |
blkArr[#blkArr] ..= "tape[tapePos] -= " .. count .. "\n" | |
i += count - 1 | |
elseif sym == '>' then | |
count = seachRepeats(seqStr, i, '>') | |
cyclePatternChecker ..= string.rep('>', count) | |
blkArr[#blkArr] ..= "tapePos += " .. count .. "\n" | |
i += count - 1 | |
elseif sym == '<' then | |
count = seachRepeats(seqStr, i, '<') | |
cyclePatternChecker ..= string.rep('<', count) | |
blkArr[#blkArr] ..= "tapePos -= " .. count .. "\n" | |
i += count - 1 | |
elseif sym == '.' then | |
cyclePatternChecker ..= sym | |
blkArr[#blkArr] ..= "out ..= string.char(tape[tapePos])\n" | |
elseif sym == ',' then | |
cyclePatternChecker ..= sym | |
blkArr[#blkArr] ..= "error('no')\n" | |
elseif sym == '[' then | |
table.insert(blkArr, "") | |
cyclePatternChecker = '[' | |
elseif sym == ']' then | |
cyclePatternChecker ..= ']' | |
if cyclePatternChecker == '[-]' then | |
table.remove(blkArr, #blkArr) | |
blkArr[#blkArr] ..= "tape[tapePos] = 0\n" | |
elseif cyclePatternChecker == '[->+<]' then | |
table.remove(blkArr, #blkArr) | |
blkArr[#blkArr] ..= "tape[tapePos + 1] += tape[tapePos]\n" | |
blkArr[#blkArr] ..= "tape[tapePos] = 0\n" | |
else | |
local last = blkArr[#blkArr] | |
table.remove(blkArr, #blkArr) | |
local whileExpr = [[ | |
while tape[tapePos] ~= 0 do | |
]] .. last .. [[ | |
end | |
]] | |
blkArr[#blkArr] ..= whileExpr | |
end | |
else end | |
i += 1 | |
end | |
blkArr[1] ..= "return out\n" | |
return blkArr[1] | |
end | |
local out: string = "" | |
local function run(code: string, tape: {number}, codePos: number, tapePos: number, skip: boolean): (boolean, number, number) | |
while tapePos > 0 and codePos <= #code do | |
if tapePos > #tape then table.insert(tape, 0) end | |
local sym = string.byte(code, codePos) | |
if sym == string.byte('[') then | |
codePos += 1 | |
repeat | |
local success, newTapePos, newCodePos = run(code, tape, codePos, tapePos, tape[tapePos] == 0) | |
tapePos = newTapePos | |
if not success then codePos = newCodePos end | |
until not success | |
elseif sym == string.byte(']') then | |
return tape[tapePos] ~= 0, tapePos, codePos | |
elseif not skip then | |
if sym == string.byte('+') then tape[tapePos] += 1 | |
elseif sym == string.byte('-') then tape[tapePos] -= 1 | |
elseif sym == string.byte('>') then tapePos += 1 | |
elseif sym == string.byte('<') then tapePos -= 1 | |
elseif sym == string.byte('.') then out ..= string.char(tape[tapePos]) print(out) | |
elseif sym == string.byte(',') then error("no") | |
else end | |
end | |
codePos += 1 | |
end | |
return false, 0, 0 | |
end | |
local function interpret(code: string, useLoadString: boolean) | |
local start = os.clock() | |
if useLoadString then | |
local c = generateFunction(code) | |
--print(c) | |
local f = loadstring(c) | |
print("generated function in " .. (os.clock() - start) .. " sec") | |
print(f()) | |
else | |
local tape: {number} = {} | |
local codePos: number = 1 | |
local tapePos: number = 1 | |
run(code, tape, codePos, tapePos, false) | |
print(out) | |
end | |
local totalDt = os.clock() - start | |
print("total " .. totalDt .. " sec") | |
end | |
interpret([==[ | |
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[ | |
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+ | |
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>> | |
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>> | |
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>> | |
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>> | |
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>> | |
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<< | |
<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<<<]>>>>>>>>>+++++++++++++++[[ | |
>>>>>>>>>]+>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>-]+[ | |
>+>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>[>->>>>[-<<<<+>>>>]<<<<[->>>>+<<<<<[->>[ | |
-<<+>>]<<[->>+>>+<<<<]+>>>>>>>>>]<<<<<<<<[<<<<<<<<<]]>>>>>>>>>[>>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[<<<<<<< | |
<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>> | |
-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>> | |
>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++ | |
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<< | |
<<<<<]]>>>] | |
]==], true) | |
-- VM useLoadString: total 27.06977099995128 sec | |
-- Codegen useLoadString: total 26.72809259989299 sec | |
-- VM useLoadString + repeats: total 11.87279310007579 sec | |
-- VM useLoadString + repeats + patterns: total 11.24207389983348 sec | |
-- Codegen useLoadString + repeats + patterns: total 6.15317820012569 sec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment