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

postFix.push(currentLexem.textOfWord); prog=prog+" "+currentLexem.textOfWord+" ";</action>

   <symbol>id</symbol>

   <action>postFix.push("define_perem");</action>

  </rightPart>

 </rule>

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

  <rightPart>

   <action>funcCall.push(postFix.size());postFix.push(currentLexem.textOfWord);prog=prog+" "+currentLexem.textOfWord;</action>

   <symbol>id</symbol>

   <action>firstPriznak=true;</action>

   <symbol>RestOper</symbol>

  </rightPart>

 </rule>

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

  <rightPart>

  </rightPart>

 </rule>

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

  <rightPart>

   <symbol>LogicOper</symbol>

  </rightPart>

 </rule>

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

  <rightPart>

  </rightPart>

 </rule>

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

  <rightPart>

   <symbol>BasePart</symbol>

  </rightPart>

 </rule>

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

  <rightPart>

   <string>{</string>

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

   <symbol>GramaConstruction</symbol>

   <string>}</string>

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

  </rightPart>

 </rule>

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

  <rightPart>

   <symbol>case</symbol>

   <symbol>caseBlock</symbol>

  </rightPart>

 </rule>

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

  <rightPart>

  </rightPart>

 </rule>

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

  <rightPart>

   <string>if</string>

   <string>(</string>

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

   <symbol>LogicOper</symbol>

   <string>)</string>

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

   <action>labels.push(++ifCount);ti.put(0,0,0,0,"if start");

 postFix.push("ifElse"+ifCount);postFix.push("JMPF");</action>

   <symbol>OperBlock</symbol>

   <action>ifCount=(Integer)labels.peek();

postFix.push("ifExit"+ifCount);postFix.push("JMP");

 postFix.push("ifElse"+ifCount+":");</action>

  </rightPart>

 </rule>

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

  <rightPart>

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

   <string>else</string>

   <symbol>OperBlock</symbol>

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

 postFix.push("ifExit"+ifCount+":");</action>

  </rightPart>

 </rule>

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

  <rightPart>

   <exclude>else</exclude>

   <action>ifCount=(Integer)labels.pop(); postFix.push("ifExit"+ifCount+":");</action>

  </rightPart>

 </rule>

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

  <rightPart>

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

   <string>(</string>

   <symbol>MethodArgs</symbol>

   <string>)</string>

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

   <action>if (firstPriznak) {

            postFix.push("this");

firstPriznak=false;

}

int rsEnd=(Integer)funcCall.pop();

int rsStart=(Integer)funcCall.pop();

ti.put(rsEnd, rsStart,0,0,"");

for(int i=rsEnd-rsStart;

 i&gt;0;

 i--){

postFix.push(postFix.get(rsStart));

postFix.remove(rsStart);

}

postFix.push("call");</action>