+function spring_pcall (f, arg, name)
+ -- FIXME: won't work if `arg' or `name' contain a backslash-escaped quot char.
+ arg = arg :gsub ("'", "\\'")
+ name = name :gsub ("'", "\\'")
+ local pattern = [[lua -l metalua.mlc -l serialize -e "print(serialize(%s('%s', '%s')))"]]
+ local cmd = string.format (pattern, f, arg, name)
+ --print ("Running the following process: " .. cmd)
+ local fd = io.popen (cmd)
+ local data = fd:read '*a'
+ fd:close()
+ --print (data)
+ local ast_builder, msg = lua_loadstring(data)
+ if not ast_builder then error ("can't compile data: "..msg) end
+ local ast = ast_builder()
+ return true, ast
+end
+