main.lua 373 B

12345678910111213141516
  1. local Lexer = require"lex"
  2. local Parser = require"parse"
  3. local Des = require"des"
  4. local Gen = require"gen"
  5. local tokens = {}
  6. for tt, ts, tr, tc in Lexer.lex(Lexer.codepoints(io.open(arg[1], "r"):read("*a"))) do
  7. tokens[#tokens + 1] = {tt, ts, tr, tc}
  8. end
  9. local ast = Parser(tokens, false)
  10. Des(ast)
  11. Gen(ast, function(str, ...) io.write(string.format(str, ...)) end)