public static void Compile(string source) { //source = source.Replace("\r", ""); try { List<Token> t = lexer.Scan(source); code = parser.Parse(t); } catch (Exception) { } }
public float Interpret(GeneratedCode code) { if (code == null) return 0; foreach (var v in Functions) { if (!code.Functions.ContainsKey(v.Key)) code.Functions[v.Key] = v.Value; } float returns = 0; foreach (Statement statement in code.TopLevelStatements.Statements) { returns = statement.Calculate(Variables, code.Functions); } return returns; }