Exemplo n.º 1
0
        public string RunProgram(string[] args, bool onlyStandardExtension)
        {
            try
            {
                _executionContext.InitField(_parser.GetSourceCode(args[0], onlyStandardExtension));
            }
            catch (FileNotFoundException)
            {
                ExitCode = -1;
                return($"Can't find file {args[0]}");
            }
            catch (ParserException e)
            {
                ExitCode = -1;
                return(e.Message);
            }

            _executionContext.ProgramArguments = args;
            string error = null;

            while (error == null && _executionContext.InterpreterAlive)
            {
                error = NextStep();
            }

            return(error);
        }
Exemplo n.º 2
0
 protected FungeFamilyLanguage(FungeContext executionContext, CommandProducer commandProducer)
 {
     _executionContext = executionContext;
     _commandProducer  = commandProducer;
     _executionContext.InitField();
 }