Cleaning
This commit is contained in:
parent
28f25c5937
commit
b94b75493a
5 changed files with 0 additions and 80 deletions
BIN
a.out
BIN
a.out
Binary file not shown.
7
main.c
7
main.c
|
|
@ -1,7 +0,0 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(int argc, const char** argv) {
|
||||
printf("your mom: %i\n",2);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
TELL 1
|
||||
TELL 2
|
||||
TELL 3
|
||||
65
mainc.lua
65
mainc.lua
|
|
@ -1,65 +0,0 @@
|
|||
local result = ""
|
||||
|
||||
local function compile_and_run(source)
|
||||
source = string.format([[
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
int main(int argc, const char** argv) {
|
||||
%s
|
||||
}
|
||||
]],source)
|
||||
print(source.."\n")
|
||||
local file = io.open("main.c","w")
|
||||
file:write(source)
|
||||
file:close()
|
||||
os.execute("gcc main.c")
|
||||
os.execute("./a.out")
|
||||
end
|
||||
|
||||
local instructions = {
|
||||
["add (%d+) (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["sub (%d+) (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["mul (%d+) (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["shl (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["shr (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["bor (%d+) (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["band (%d+) (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["li (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["li (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end,
|
||||
["li (%d+) (%d+)"] = function(l,d,a,b)
|
||||
|
||||
end
|
||||
}
|
||||
|
||||
local source = {string.format("int32_t registers = {%s}",string.rep("0",0,","))}
|
||||
|
||||
local input = io.open("main.funny")
|
||||
local index = 1
|
||||
for line in input:read("a"):gmatch("[^\n\r]") do
|
||||
table.insert(string.format("instruction%i:",index)) -- add the goto label for the line
|
||||
instruction = instruction + 1
|
||||
local target
|
||||
for pattern,callback in pairs(instructions) do
|
||||
line:match(pattern)
|
||||
end
|
||||
end
|
||||
compile_and_run(table.concat(source,"\n"))
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
PUT welcome to the funnycore
|
||||
li 0 10
|
||||
li 1 20
|
||||
PUT i have updated registers
|
||||
HALT
|
||||
Loading…
Add table
Add a link
Reference in a new issue