17 lines
373 B
Lua
17 lines
373 B
Lua
local Lexer = require"lex"
|
|
local Parser = require"parse"
|
|
local Des = require"des"
|
|
local Gen = require"gen"
|
|
|
|
local tokens = {}
|
|
|
|
for tt, ts, tr, tc in Lexer.lex(Lexer.codepoints(io.open(arg[1], "r"):read("*a"))) do
|
|
tokens[#tokens + 1] = {tt, ts, tr, tc}
|
|
end
|
|
|
|
local ast = Parser(tokens, false)
|
|
|
|
Des(ast)
|
|
|
|
Gen(ast, function(str, ...) io.write(string.format(str, ...)) end)
|