SyntaxError = table{} function syntax_error(s) return table SyntaxError{value=["Syntax error: ",s,"."].join()} end Symbol = table(Type,"Symbol"){} Id = table(Type,"Id"){} function scan(s) a = [] n = len(s) i = 0 line = 0 col = 0 while i=level return t[1..].map(|x| ast_to_string(x,op_level)).join(op) else return t[1..].map(ast_to_string).join(op,"(",")") end elif op=="~" return ["-",ast_to_string(t[1],3)].join() else return t[1..].map(ast_to_string).join(",",str(op)+"(",")") end else return str(t) end end function compile(s) return ast(scan(s)) end