This sounds like perfect fodder for something like metalua.
-- The extension itself: --
-{ block:
mlp.lexer:add "chunk"
mlp.expr:add{ "chunk", mlp.block, "end",
builder = |x|`String {mlc.ast_to_luacstring(x[1])} } }
-- simple test case: --
local ch = chunk return 123 end
assert (ch :match "^\027Lua")
assert (dostring(ch) == 123)
print "Test passed"