public void Setup(DencProgram program, ClassHeir classHeir, IStatement sparent, ref StatementFlowInitializer flow) { parent = classHeir; Length = Wordsize.Number(); flow.SetupStorage(this); }
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); } }
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); } }
public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow) { throw new NotImplementedException(); }
public void Emit(CodeWriter writer, DencProgram program) { throw new NotImplementedException(); }
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; } }
public void Emit(CodeWriter writer, DencProgram program) { }
public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow) { flow.LastLabel = this; }
public Modern(DencProgram program) { Program = program; ArchitectureType = ArchitectureTypes.Modern; DefaultRadix = 10; }
public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow) { flow.Radix = BaseSet.Number(10); // Radixen are always base 10 }
public void Setup(DencProgram program, ClassHeir classHeir, IStatement parent, ref StatementFlowInitializer flow) { radix = flow.Radix; }
public PDP10(DencProgram program) { Program = program; ArchitectureType = ArchitectureTypes.PDP10; DefaultRadix = 8; }
public Generate(DencProgram program) { dencProg = program; }