public ECustomFunction(EWord name, ETypeWord type, EProgram program, ETypeNameKey[] arguments) { this.name = name; this.type = type; this.arguments = arguments; this.program = program; }
public EFunctionOperation(EWord name, ETypeWord type, ETypeNameKey[] arguments, EOperation[] operations) { this.name = name; this.type = type; this.arguments = arguments; program = new EProgram(operations); }
// Run a program public static EVariable Run(EProgram program, EScope scope) { // Create a variable to assign the output to EVariable output = new EVVoid(); // Loop over every instruction and return the last value EOperation[] operations = program.GetOperations(); foreach (EOperation operation in operations) { output = operation.Exec(scope); } return(output); }
static void Main(string[] args) { if (args.Length > 1) { throw new ELangException("Please do not supply more than 1 argument"); } Interpreter interpreter = new Interpreter(); if (args.Length == 0) { while (true) { Console.Write("> "); string next = Console.ReadLine(); if (next == "quit") { break; } try { EProgram prog = EParser.Program.Parse(next); string result = interpreter.Run(prog).ToString(); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine(e.Message); } } } else if (args.Length == 1) { try { string input = File.ReadAllText(args[0], Encoding.UTF8); EProgram test = EParser.Program.Parse(input); //Console.WriteLine(test); interpreter.Run(test); } catch (Exception e) { Console.WriteLine(e.Message); } } /* */ }
public EWhileOperation(ESolvable check, EOperation[] operations) { this.check = check; program = new EProgram(operations); }
public ECustomFunction(EWord name, ETypeWord type, EProgram program) : this(name, type, program, new ETypeNameKey[] { }) { }
public EVariable Run(EProgram program) { return(Run(program, scope)); }
public EIfOperation(ESolvable check, EOperation[] operations, EOperation[] elseOperations) : this(check, operations) { elseProgram = new EProgram(elseOperations); }