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

  </rule>

 </automat>

 <automat name='MultiComment'>

  <rule groupWordsName='EndComment'>

   <expression>[*]</expression>

   <action>ignoreLastWord=true;

lexStk.push(lexAcceptor);

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

  </rule>

  <rule groupWordsName='NewCommentStart'>

   <expression>[/]</expression>

   <action>ignoreLastWord=true;

lexStk.push(lexAcceptor);

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

  </rule>

  <rule groupWordsName='other'>

   <expression>other+</expression>

   <action>ignoreLastWord=true;</action>

  </rule>

 </automat>

 <automat name='CheckStart'>

  <rule groupWordsName='CheckAgain'>

   <expression>[/]</expression>

   <action>ignoreLastWord=true;</action>

   <comment>случай //* как быть..7</comment>

  </rule>

  <rule groupWordsName='Checked'>

   <expression>[*]</expression>

   <action>ignoreLastWord=true;

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

  </rule>

  <rule groupWordsName='NoChecked'>

   <expression>other+</expression>

   <action>ignoreLastWord=true;

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

  </rule>

 </automat>

 <automat name='CheckEnd'>

  <rule groupWordsName='CheckAgain'>

   <expression>[*]</expression>

   <action>ignoreLastWord=true;</action>

   <comment>**/</comment>

  </rule>

  <rule groupWordsName='Checked'>

   <expression>[/]</expression>

   <action>ignoreLastWord=true;

lexStk.pop();

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

  </rule>

  <rule groupWordsName='NoChecked'>

   <expression>other+</expression>

   <action>ignoreLastWord=true;

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

  </rule>

 </automat>

</lexic>

<syntax>

 <data>

Stack postFix=new Stack();

Stack minusStk=new Stack();

Stack divStk=new Stack();

Stack brakets =new Stack();

Stack labels=new Stack();

Stack callStack=new Stack();

Stack memoryStack=new Stack();

String prog="";

Stack funcStack=new Stack();

String pfz="";

boolean firstPriznak=false;

boolean funcPriznak=false;

int forCount=0;

int ifCount=0;

int selectCount=0;

int caseCount=0;

int minusPrior=0;

String typeId="";

String Modifier="";

class MinusClass{

public boolean Unary;

public int Priority;

public MinusClass(int p, boolean u){

Unary=u;

Priority=p;

}

public String toString(){return "-";}

public int compareTo(String s){return "-".compareTo(s);}

};

class DivClass{

public int Priority;

public DivClass(int p){

Priority=p;

}

public String toString(){return "/";}

public int compareTo(String s){return "/".compareTo(s);}

};

class ClassTable{

      ArrayList&lt;String&gt; resolvedTypes;

      ArrayList&lt;Class&gt; classes;

      public ClassTable(){

        this.resolvedTypes=new ArrayList&lt;String&gt;();

        this.classes=new ArrayList&lt;Class&gt;();

        this.resolvedTypes.add("card");

        this.resolvedTypes.add("float");

        this.resolvedTypes.add("char");

        this.resolvedTypes.add("logic");

      }

  public boolean BaseType(String Name){

        for(int i=0; i&lt;4; i++){

            if(this.resolvedTypes.get(i).compareTo(Name)==0)

                return true;

        }

        return false;

      };

      public String toString(){

            String buf="";

            for(Class cl:classes){