lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


indeed Tom's solution should work. The complete (and also untested) program would look like:

function ast_compare(ast1, ast2)
    [...snip...]
end
mlc = require 'metalua.compiler'.new()

function compare(src1, src2)
    local ast1 = mlc.src_to_ast(src1)
    local ast2 = mlc.src_to_ast(src2)
    if ast_compare(ast1, ast2) then print "EQUAL" end
end

It would also require a "luarocks install metalua-parser" at some point to run.