Exemple #1
0
 public void Setup(DencProgram program, ClassHeir classHeir, IStatement sparent,
                   ref StatementFlowInitializer flow)
 {
     parent = classHeir;
     Length = Wordsize.Number();
     flow.SetupStorage(this);
 }
Exemple #2
0
        private void EmitArray(CodeWriter writer, DencProgram program)
        {
            var sb = new StringBuilder();

            sb.Append("private Words _");
            sb.Append(Identifier);

            writer.WriteStatement(sb);

            sb.Append('_');
            sb.Append(Identifier);
            sb.Append(" = new Words(this, ");
            sb.Append(StartAddress.ToString());
            sb.Append(", ");
            sb.Append(Length.ToString());
            sb.Append(")");

            parent.ConstructorAdd.Add(sb.ToString());
            sb.Clear();

            if (ExposeProperty)
            {
                sb.Append("public Words ");
                sb.Append(Identifier);
                sb.Append("{ get { return ");
                sb.Append('_');
                sb.Append(Identifier);
                sb.Append("; } }");

                writer.WriteStatementNoSemi(sb);
            }
        }
Exemple #3
0
        public void Emit(CodeWriter writer, DencProgram program)
        {
            if (Length > 1)
            {
                EmitArray(writer, program);
                return;
            }
            var sb = new StringBuilder();

            sb.Append("private Word _");
            sb.Append(Identifier);

            writer.WriteStatement(sb);

            sb.Append('_');
            sb.Append(Identifier);
            sb.Append(" = new Word(this, ");
            sb.Append(StartAddress.ToString());
            sb.Append(")");

            parent.ConstructorAdd.Add(sb.ToString());
            sb.Clear();

            if (ExposeProperty)
            {
                sb.Append("public Word36 ");
                sb.Append(Identifier);
                sb.Append("{ get { return ");
                sb.Append('_');
                sb.Append(Identifier);
                sb.Append(".GetValue; } set { ");
                sb.Append('_');
                sb.Append(Identifier);
                sb.Append(".SetValue(value); } }");

                writer.WriteStatementNoSemi(sb);
            }
        }
Exemple #4
0
 public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow)
 {
     throw new NotImplementedException();
 }
Exemple #5
0
 public void Emit(CodeWriter writer, DencProgram program)
 {
     throw new NotImplementedException();
 }
Exemple #6
0
        protected override void DoAction(int action)
        {
            switch (action)
            {
            case 2:     // Program -> Architecture, TopLevelStatementList
            {
                CurrentSemanticValue.program =
                    DencMainProgram          =
                        new DencProgram(ValueStack[ValueStack.Depth - 2].architecture,
                                        ValueStack[ValueStack.Depth - 1].statementlist);
            }
            break;

            case 3:     // Architecture -> ARCHITECTURE, IDENTIFIER, ENDOFLINE
            {
                CurrentSemanticValue.architecture = new Architecture(ValueStack[ValueStack.Depth - 2].tVal);
            }
            break;

            case 4:     // TopLevelStatementList -> TopLevelStatement
            {
                CurrentSemanticValue.statementlist = new List <IStatement>
                {
                    ValueStack[ValueStack.Depth - 1].statement
                };
            }
            break;

            case 5:     // TopLevelStatementList -> TopLevelStatementList, TopLevelStatement
            {
                ValueStack[ValueStack.Depth - 2].statementlist.Add(ValueStack[ValueStack.Depth - 1].statement);
                CurrentSemanticValue.statementlist = ValueStack[ValueStack.Depth - 2].statementlist;
            }
            break;

            case 6:     // TopLevelStatement -> NameSpace
            {
                CurrentSemanticValue.statement = ValueStack[ValueStack.Depth - 1].statement;
            }
            break;

            case 7:     // TopLevelStatement -> ClassDeclaration
            {
                CurrentSemanticValue.statement = ValueStack[ValueStack.Depth - 1].classheir;
            }
            break;

            case 8:     // TopLevelStatement -> ENDOFLINE
            {
                CurrentSemanticValue.statement = null;
            }
            break;

            case 9:     // NameSpace -> NAMESPACE, NameList, ENDOFLINE
            {
                CurrentSemanticValue.statement = new NameSpace(ValueStack[ValueStack.Depth - 2].stringlist);
            }
            break;

            case 10:     // NameList -> IDENTIFIER
            {
                CurrentSemanticValue.stringlist = new List <string> {
                    ValueStack[ValueStack.Depth - 1].tVal
                };
            }
            break;

            case 11:     // NameList -> NameList, PERIOD, IDENTIFIER
            {
                ValueStack[ValueStack.Depth - 3].stringlist.Add(ValueStack[ValueStack.Depth - 1].tVal);
                CurrentSemanticValue.stringlist = ValueStack[ValueStack.Depth - 3].stringlist;
            }
            break;

            case 12:     // ClassDeclaration -> CLASS, IDENTIFIER, ENDOFLINE, OPENLEVEL, SubLevel,
                //                     CLOSELEVEL
            {
                CurrentSemanticValue.classheir = new ClassHeir(ValueStack[ValueStack.Depth - 5].tVal,
                                                               ValueStack[ValueStack.Depth - 2].statementlist);
            }
            break;

            case 13:     // SubLevel -> SubLevelStatement
            {
                CurrentSemanticValue.statementlist = new List <IStatement>
                {
                    ValueStack[ValueStack.Depth - 1].statement
                };
            }
            break;

            case 14:     // SubLevel -> SubLevel, SubLevelStatement
            {
                ValueStack[ValueStack.Depth - 2].statementlist.Add(ValueStack[ValueStack.Depth - 1].statement);
                CurrentSemanticValue.statementlist = ValueStack[ValueStack.Depth - 2].statementlist;
            }
            break;

            case 15:     // SubLevelStatement -> ClassDeclaration
            {
                CurrentSemanticValue.statement = ValueStack[ValueStack.Depth - 1].classheir;
            }
            break;

            case 16:     // SubLevelStatement -> SubLevelOption
            {
                CurrentSemanticValue.statement = ValueStack[ValueStack.Depth - 1].statement;
            }
            break;

            case 17:     // SubLevelStatement -> Label
            {
                CurrentSemanticValue.statement = ValueStack[ValueStack.Depth - 1].statement;
            }
            break;

            case 18:     // SubLevelStatement -> ENDOFLINE
            {
                CurrentSemanticValue.statement = null;
            }
            break;

            case 19:     // SubLevelOption -> Radix
            {
                CurrentSemanticValue.statement = ValueStack[ValueStack.Depth - 1].statement;
            }
            break;

            case 21:     // Radix -> RADIX, Constant, ENDOFLINE
            {
                CurrentSemanticValue.statement = new SetRadix(ValueStack[ValueStack.Depth - 2].constant);
            }
            break;

            case 22:     // Word -> WORD, Constant, ENDOFLINE
            {
                CurrentSemanticValue.statement = new Word(ValueStack[ValueStack.Depth - 2].constant);
            }
            break;

            case 23:     // Constant -> CONSTANT
            {
                CurrentSemanticValue.constant = new Constant(ValueStack[ValueStack.Depth - 1].tVal);
            }
            break;

            case 24:     // Label -> IDENTIFIER, COLON
            {
                CurrentSemanticValue.statement = new Label(ValueStack[ValueStack.Depth - 2].tVal);
            }
            break;
            }
        }
Exemple #7
0
 public void Emit(CodeWriter writer, DencProgram program)
 {
 }
Exemple #8
0
 public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow)
 {
     flow.LastLabel = this;
 }
Exemple #9
0
 public Modern(DencProgram program)
 {
     Program          = program;
     ArchitectureType = ArchitectureTypes.Modern;
     DefaultRadix     = 10;
 }
Exemple #10
0
 public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow)
 {
     flow.Radix = BaseSet.Number(10); // Radixen are always base 10
 }
Exemple #11
0
 public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow)
 {
     radix = flow.Radix;
 }
Exemple #12
0
 public PDP10(DencProgram program)
 {
     Program          = program;
     ArchitectureType = ArchitectureTypes.PDP10;
     DefaultRadix     = 8;
 }
Exemple #13
0
 public Generate(DencProgram program)
 {
     dencProg = program;
 }