Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Clear"/> class.
 /// </summary>
 /// <param name="runEnvironment">Run time environment.</param>
 /// <param name="variableRepository">Variable Repository.</param>
 /// <param name="dataStatementReader">Data statement reader.</param>
 public Clear(
     IRunEnvironment runEnvironment,
     IVariableRepository variableRepository,
     IDataStatementReader dataStatementReader)
     : base("CLEAR", TokenClass.Statement)
 {
     _runEnvironment      = runEnvironment;
     _variableRepository  = variableRepository;
     _dataStatementReader = dataStatementReader;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Read"/> class.
 /// </summary>
 /// <param name="runEnvironment">Run time environment.</param>
 /// <param name="expressionEvaluator">Expression evaluator.</param>
 /// <param name="dataStatementReader">Data statement reader.</param>
 public Read(
     IRunEnvironment runEnvironment,
     IExpressionEvaluator expressionEvaluator,
     IDataStatementReader dataStatementReader)
     : base("READ", TokenClass.Statement)
 {
     _runEnvironment      = runEnvironment;
     _expressionEvaluator = expressionEvaluator;
     _dataStatementReader = dataStatementReader;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="New"/> class.
 /// </summary>
 /// <param name="runEnvironment">Run time environment.</param>
 /// <param name="programRepository">Program Repository.</param>
 /// <param name="variableRepository">Variable Repository.</param>
 /// <param name="dataStatementReader">Data statement reader.</param>
 public New(
     IRunEnvironment runEnvironment,
     IProgramRepository programRepository,
     IVariableRepository variableRepository,
     IDataStatementReader dataStatementReader)
     : base("NEW", TokenClass.Statement)
 {
     _runEnvironment      = runEnvironment;
     _programRepository   = programRepository;
     _variableRepository  = variableRepository;
     _dataStatementReader = dataStatementReader;
 }
Ejemplo n.º 4
0
 public ConsoleBASICInterpreter()
 {
     BASICRunEnvironment     = new RunEnvironment();
     BASICProgramRepository  = new ProgramRepository();
     BASICVariableRepository = new VariableRepository();
     BASICDataStatement      = new DataStatementReader(BASICRunEnvironment, BASICProgramRepository);
     BASICExpresionEval      = new ExpressionEvaluator(BASICVariableRepository, BASICRunEnvironment);
     BASICTokensProvider     = new TokensProvider(new IToken[] {
         new ClassicBasic.Interpreter.Commands.Clear(BASICRunEnvironment, BASICVariableRepository, BASICDataStatement),
         new ClassicBasic.Interpreter.Commands.Cont(BASICRunEnvironment, BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.Data(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.Def(BASICRunEnvironment, BASICExpresionEval),
         new ClassicBasic.Interpreter.Commands.Del(BASICRunEnvironment, BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.Dim(BASICRunEnvironment, BASICExpresionEval, BASICVariableRepository),
         new ClassicBasic.Interpreter.Commands.Dim(BASICRunEnvironment, BASICExpresionEval, BASICVariableRepository),
         new ClassicBasic.Interpreter.Commands.Edit(BASICRunEnvironment, BASICProgramRepository, this),
         new ClassicBasic.Interpreter.Commands.Else(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.End(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.For(BASICRunEnvironment, BASICExpresionEval, BASICVariableRepository),
         //new ClassicBasic.Interpreter.Commands.Get(BASICRunEnvironment,BASICExpresionEval,this),
         new ClassicBasic.Interpreter.Commands.Gosub(BASICRunEnvironment, BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.Goto(BASICRunEnvironment, BASICExpresionEval, BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.If(BASICRunEnvironment, BASICExpresionEval, BASICProgramRepository),
         //new ClassicBasic.Interpreter.Commands.Input(BASICRunEnvironment,BASICExpresionEval,BASICVariableRepository, this),
         new ClassicBasic.Interpreter.Commands.Let(BASICRunEnvironment, BASICExpresionEval),
         new ClassicBasic.Interpreter.Commands.List(BASICProgramRepository, this, BASICRunEnvironment),
         //new ClassicBasic.Interpreter.Commands.Load(BASICRunEnvironment,BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.New(BASICRunEnvironment, BASICProgramRepository, BASICVariableRepository, BASICDataStatement),
         new ClassicBasic.Interpreter.Commands.Next(BASICRunEnvironment, BASICVariableRepository),
         new ClassicBasic.Interpreter.Commands.On(BASICRunEnvironment, BASICExpresionEval, BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.OnErr(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.Pop(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.Print(BASICRunEnvironment, BASICExpresionEval, this),
         new ClassicBasic.Interpreter.Commands.Read(BASICRunEnvironment, BASICExpresionEval, BASICDataStatement),
         new ClassicBasic.Interpreter.Commands.Remark(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.Restore(BASICRunEnvironment, BASICDataStatement),
         new ClassicBasic.Interpreter.Commands.Resume(BASICRunEnvironment, BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.Return(BASICRunEnvironment),
         new ClassicBasic.Interpreter.Commands.Run(BASICRunEnvironment, BASICProgramRepository, BASICVariableRepository, BASICDataStatement),
         //new ClassicBasic.Interpreter.Commands.Save(BASICRunEnvironment,BASICProgramRepository),
         new ClassicBasic.Interpreter.Commands.Stop(BASICRunEnvironment),
     });
     BASICTokeniser = new Tokeniser(BASICTokensProvider);
     BASICExecutor  = new ExecutorFrameBased(this, BASICRunEnvironment, BASICProgramRepository, BASICTokensProvider, BASICTokeniser);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Restore"/> class.
 /// </summary>
 /// <param name="runEnvironment">Run environment.</param>
 /// <param name="dataStatementReader">Data statement reader to use.</param>
 public Restore(IRunEnvironment runEnvironment, IDataStatementReader dataStatementReader)
     : base("RESTORE", TokenClass.Statement)
 {
     _runEnvironment      = runEnvironment;
     _dataStatementReader = dataStatementReader;
 }