Семантика языков программирования. Семантический анализ и элементы генерации объектного кода или интерпретации, страница 11

   <action>prog=prog+"; ";postFix.push("IfEnd"+forCount);

postFix.push("JMPF");

postFix.push("IfOper"+forCount);

postFix.push("JMP");

postFix.push(" Label_IfNext"+forCount+":");</action>

   <symbol>O</symbol>

   <action>postFix.push("IfStart"+forCount);

postFix.push("JMP");

 prog=prog+" ) ";</action>

   <string>)</string>

   <action>postFix.push(" Label_IfOper"+forCount+":");</action>

   <symbol>OperBlock</symbol>

   <action>forCount=(Integer)labels.pop();

  postFix.push(" Label_IfStart"+forCount);

  postFix.push("JMP");

  postFix.push( "Label_IfEnd" +forCount+":");</action>

  </rightPart>

 </rule>

 <rule for='Classes' leftPart='SelectConstuction'>

  <rightPart>

   <string>select</string>

   <action>prog=prog+" switch( ";</action>

   <symbol>NowOrExp</symbol>

   <action>prog=prog+"){";postFix.push("select");labels.push(++selectCount);caseCount=0;labels.push(caseCount);</action>

   <symbol>caseBlock</symbol>

   <string>end</string>

   <action>prog=prog+"}";</action>

   <string>;</string>

   <action>caseCount=(Integer)labels.pop();

selectCount=(Integer)labels.pop();

postFix.push("select"+selectCount+"case"+(caseCount++)+":");

 postFix.push( "selectEnd" +selectCount+ ":" );</action>

  </rightPart>

 </rule>

 <rule for='GramaConstruction' leftPart='IfConstruction'>

  <rightPart>

   <symbol>IF_AND_CHECK</symbol>

   <symbol>NOCHECK</symbol>

  </rightPart>

 </rule>

 <rule for='Classes' leftPart='NowOrExp'>

  <rightPart>

   <string>get</string>

   <action>funcCall.push(postFix.size());

 postFix.push(currentLexem.textOfWord);

prog=prog+"new "+currentLexem.textOfWord;</action>

   <symbol>id</symbol>

   <action>funcCall.push(postFix.size());</action>

   <symbol>FunctionArgs</symbol>

   <action>postFix.pop();postFix.push("call_constructor");</action>

  </rightPart>

 </rule>

 <rule for='Classes' leftPart='NowOrExp'>

  <rightPart>

   <symbol>MathExp</symbol>

  </rightPart>

 </rule>

 <rule for='Classes' leftPart='RestAnyOp'>

  <rightPart>

   <action>funcCall.pop();memoryStack.push(postFix.peek());prog=prog+"=";</action>

   <symbol>assign</symbol>

   <symbol>NowOrExp</symbol>

   <action>tetrades.add(new Tetrade("&lt;=", "POP"," ",memoryStack.pop().toString()));

 postFix.push("&lt;=");</action>

  </rightPart>

  <comment>Присваивание</comment>

 </rule>

 <rule for='Classes' leftPart='RestAnyOp'>

  <rightPart>

   <action>firstPriznak=true;funcCall.push(postFix.size());</action>

   <symbol>FunctionArgs</symbol>

  </rightPart>

 </rule>

 <rule for='Classes' leftPart='RestAnyOp'>

  <rightPart>

   <symbol>MethodOrData</symbol>

  </rightPart>

 </rule>

 <rule for='Classes' leftPart='RestAnyOp'>

  <rightPart>

   <action>funcCall.pop();if(!ct.Resolved(postFix.peek().toString())||ct.Resolved(currentLexem.textOfWord.toString())){

ti.put(0,0,0,0,"type fail");

return false;

}

tetrades.add(new Tetrade("MALLOC",postFix.peek().toString(), "",currentLexem.textOfWord.toString()));