public string Visit(FunctionDefinition node) { Scope = node.AnchorToken.Value; var entryPoint = node.AnchorToken.Value.Equals("main")? "\t\t.entrypoint\n": ""; var exit = "\t\tldc.i4 0\n"; exit += node.AnchorToken.Value.Equals("main")? "\t\tcall void class ['mscorlib']'System'.'Environment'::'Exit'(int32)\n\t\tret\n": "\t\tret\n"; var parameterList = Visit((dynamic)node[0]); var varDefinition = Visit((dynamic)node[1]); var body = Visit((dynamic)node[2]); var returnType = node.AnchorToken.Value.Equals("main")? "void": "int32"; var result = "\t.method public static " + returnType + " '" + node.AnchorToken.Value + "'(" + parameterList + ") {\n" + entryPoint + varDefinition + body + exit + "\n\t}\n"; Variables.CleanArgs(); return(result); }