public MachineRegister(string name, int code, int bits, MachineSpec spec)
 {
     Name = name;
     Code = code;
     Bits = bits;
     InstructionSets.Add(spec);
 }
 public MachineRegister(string name, int code, MachineRegisterType type, MachineSpec spec)
 {
     Name         = name;
     Code         = code;
     RegisterType = type;
     Bits         = type.Bits;
     InstructionSets.Add(spec);
 }
 public CoatingSchedule()
 {
     foreach (string line in StaticFactoryValuesManager.CoatingLines)
     {
         InstructionSets.Add(new CoatingLineInstructionSet(line));
     }
     CurrentSchedule = this;
 }
Example #4
0
        private void CompileClassStmt(ClassStatement stmt, Scope scope)
        {
            scope = new Scope {
                Out = scope, LocalTable = new LocalTable(), Self = stmt, Line = 0
            };
            var instructionSet = new InstructionSet();

            instructionSet.SetLabel($"{InstructionType.LabelDefClass}:{stmt.Name.Value}");

            CompileBlockStatement(instructionSet, stmt.Body, scope, scope.LocalTable);
            instructionSet.Define(InstructionType.Leave);
            InstructionSets.Add(instructionSet);
        }
Example #5
0
        private void CompileBlockArgExpression(int index, CallExpression exp, Scope scope, LocalTable table)
        {
            var instructionSet = new InstructionSet();

            instructionSet.SetLabel($"{InstructionType.Block}:{index}");

            for (int i = 0; i < exp.Arguments.Count; i++)
            {
                table.Set(exp.BlockArguments[i].Value);
            }

            CompileBlockStatement(instructionSet, exp.Block, scope, table);
            EndInstructions(instructionSet);
            InstructionSets.Add(instructionSet);
        }
Example #6
0
        private void CompileStatements(List <IStatement> statements, Scope scope, LocalTable localTable)
        {
            var instructionSet = new InstructionSet {
                Label = new Label {
                    Name = InstructionType.Program
                }
            };

            foreach (var statement in statements)
            {
                CompileStatement(instructionSet, statement, scope, localTable);
            }

            EndInstructions(instructionSet);
            InstructionSets.Add(instructionSet);
        }
Example #7
0
        private void CompileDefStmt(DefStatement stmt, Scope scope)
        {
            scope = new Scope {
                Out = scope, LocalTable = new LocalTable(), Self = stmt, Line = 0
            };
            var instructionSet = new InstructionSet();

            instructionSet.SetLabel($"{InstructionType.LabelDef}:{stmt.Name.Value}");

            for (int i = 0; i < stmt.Parameters.Count; i++)
            {
                scope.LocalTable.SetLCL(stmt.Parameters[i].Value, scope.LocalTable.Depth);
            }

            CompileBlockStatement(instructionSet, stmt.BlockStatement, scope, scope.LocalTable);
            EndInstructions(instructionSet);
            InstructionSets.Add(instructionSet);
        }