mirror of
https://github.com/emptyynes/LIVM.git
synced 2026-01-12 11:04:51 +03:00
Add files via upload
This commit is contained in:
parent
560bc596ad
commit
45700a571c
9 changed files with 81 additions and 32 deletions
5
faxm/fraCinize.lua
Normal file
5
faxm/fraCinize.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
source = function(source)
|
||||
return source
|
||||
end
|
||||
}
|
||||
14
faxm/fraxevice.lua
Normal file
14
faxm/fraxevice.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
source = function(source)
|
||||
source = source:gsub("(%s*)console%.print%s+(%S+%s+%S+);", "%1console.write %2;%1console.out;")
|
||||
source = source:gsub("(%a+)%.write", "write ____%1")
|
||||
source = source:gsub("(%a+)%.out", "out ____%1")
|
||||
source = source:gsub("(%a+)%.wait", "wait ____%1")
|
||||
source = source:gsub("(%a+)%.read", "read ____%1")
|
||||
source = source:gsub("____clock", "|0")
|
||||
source = source:gsub("____timer", "|0")
|
||||
source = source:gsub("____console", "|1")
|
||||
source = source:gsub("____rom", "|2")
|
||||
return source
|
||||
end
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
return {
|
||||
source = function(source)
|
||||
return source:gsub("\n", ""):gsub("]", "];"):gsub(":", ":;")
|
||||
return source:gsub("\n", "")
|
||||
end,
|
||||
any_line = function(line)
|
||||
return line:trim():gsub("%s+", " ")
|
||||
return line:trim():gsub("%s+", " "):gsub("%s+=%s+", "=")
|
||||
end,
|
||||
line = function(line)
|
||||
return line:gsub(",", " "):gsub("%s+", " "):split" "
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
return {
|
||||
source = function(source)
|
||||
local tl = {}
|
||||
while source:match[[|"[^"]+"]] do
|
||||
local s = source:match[[|"[^"]+"]]
|
||||
local ss = s
|
||||
|
|
@ -16,11 +17,20 @@ return {
|
|||
r[#r + 1] = "|x" .. table.concat(rt, "")
|
||||
end
|
||||
end
|
||||
if #(r[#r]:gsub("000", "")) == #(r[#r]) then
|
||||
r[#r + 1] = "|x0000000000000000"
|
||||
end
|
||||
local function regexEscape(str)
|
||||
return str:gsub("[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%1")
|
||||
end
|
||||
source = source:gsub(regexEscape(ss), table.concat(r, ", "))
|
||||
local tt = table.concat(r, ", ")
|
||||
tl[tt] = #r
|
||||
source = source:gsub(regexEscape(ss), tt)
|
||||
end
|
||||
source = source:gsub("(string%s+(%w+)%s?:(%s+)([|xa-f0-9, ]+)[^;])", function(found)
|
||||
found = "object" .. found:sub(7)
|
||||
return found .. " ? length=|" .. tostring(tl[found:gsub("object%s+%w+%s?:(%s+)", "")] * 8)
|
||||
end)
|
||||
return source
|
||||
end
|
||||
}
|
||||
9
faxm/ximplifier.lua
Normal file
9
faxm/ximplifier.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
source = function(source)
|
||||
source = source:gsub("%(([^)]+)%)", " %1")
|
||||
source = source:gsub("([|%^#][%w.]+%s+)([a-z]+)", "%1;%2"):gsub(":", ":;")
|
||||
source = source:gsub("object", ";object"):gsub("section", ";section"):gsub("%[", ";["):gsub("%]", "];")
|
||||
source = source:gsub("(\n%s+);", ";%1"):gsub(";(%s+);", ";%1"):gsub("^;", "")
|
||||
return source .. ";"
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue