static public string resolveAssignment(GlobalVariables g, parser.Assignment assignment) { string varName = assignment.Variable.Name; if (varName == null) { return("resolveAssignment(): variable name can NOT be empty."); } g.Variables[varName] = assignment.String; return(null); }
static public string resolveStatement(GlobalVariables g, parser.Statement statement) { var assignment = new parser.Assignment().GetType(); var print = new parser.Print().GetType(); if (statement.GetType() == assignment) { return(resolveAssignment(g, (parser.Assignment)statement)); } else if (statement.GetType() == print) { return(resolvePrint(g, (parser.Print)statement)); } return("resolveStatement(): undefined statement type."); }