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

   <action>ignoreLastWord=true;

lexStk.push(lexAcceptor);

lexAcceptor=lexAcceptors[findAutomat("MultiComment")];</action>

  </rule>

  <rule groupWordsName='assign'>

   <expression>"&lt;="</expression>

  </rule>

  <rule groupWordsName='char'>

   <expression>"'\x"[0-9a-fA-f][0-9a-fA-f][']</expression>

   <action>identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);

identTable.Insert(Lexem);</action>

  </rule>

  <rule groupWordsName='char'>

   <expression>['][\\]?[][']</expression>

   <action>identTable.Insert(Lexem);</action>

  </rule>

  <rule groupWordsName='comp'>

   <expression>[=]?[&gt;&lt;]</expression>

   <action>

</action>

   <comment>=&lt; =&gt; &lt; &gt;</comment>

  </rule>

  <rule groupWordsName='comp'>

   <expression>[!]?[=]</expression>

   <comment>Рано или не равно</comment>

  </rule>

  <rule groupWordsName='float_const'>

   <expression>("0."[0-9]+)|([1-9][0-9]*[.][0-9]+)</expression>

   <action>identTable.Insert(Lexem);</action>

  </rule>

  <rule groupWordsName='id'>

   <expression>[a-zA-Z]+[0-9][a-zA-Z]+</expression>

   <action>identTable.Insert(Lexem);</action>

   <comment>Идентификатор</comment>

  </rule>

  <rule groupWordsName='int_const'>

   <expression>([0])|([1-9][0-9]*)</expression>

   <action>identTable.Insert(Lexem);</action>

   <comment>Целая константа</comment>

  </rule>

  <rule groupWordsName='logic'>

   <expression>[!] | ([&][&]) | ([|][|])</expression>

   <comment>Логика</comment>

  </rule>

  <rule groupWordsName='sign'>

   <expression>[-+*/(){}[\];:,.]</expression>

   <comment>Символы</comment>

  </rule>

  <rule groupWordsName='space'>

   <expression>[ \t\r\n]+</expression>

   <action>ignoreLastWord=true;</action>

   <comment>Символы форматирования</comment>

  </rule>

  <rule groupWordsName='word'>

   <expression>[a-z]+</expression>

   <action>String lexWord=Lexem.textOfWord.toString();

if(lexWord.compareTo("cardinal")==0||lexWord.compareTo("cardina")==0||lexWord.compareTo("cardin")==0||lexWord.compareTo("cardi")==0)

Lexem.textOfWord=new StringBuffer("card");

if(!identTable.Search(Lexem)){

ti.put(Lexem.groupIndex, Lexem.wordIndex, "Unresolved token: "+Lexem.textOfWord);

}</action>

  </rule>

 </automat>

 <automat name='LineComent'>

  <rule groupWordsName='Comment'>

   <expression>other+</expression>

   <action>ignoreLastWord=true;</action>

   <comment>Внутри комментария</comment>

  </rule>

  <rule groupWordsName='EndComent'>

   <expression>[\r\n]</expression>

   <action>ignoreLastWord=true;

lexAcceptor=(fAutomat)lexStk.pop();</action>

   <comment>Вытаскиваем из стека автомат, который использовался до обнаружения комментария.</comment>