资源简介

1)简洁的用户使用界面 2)可以实现if-else和if的循环嵌套 3)具备一定的检错能力 4)用LR分析方法实现分析 5)不过循环体中只能是一条赋值语句

资源截图

代码片段和文件信息

/*
 * To change this template choose Tools | Templates
 * and open the template in the editor.
 */

package my.ifelse;

/**
 *
 * @author dd
 */
import java.util.*;

class Equation{
    int numflag=0;
    String abcd;
    Equation(int numString aString bString cString d)
    {
        this.num=num;
        this.a=a; this.b=b; this.c=c; this.d=d;
    }
}

public class translate {

    public translate(Vector link){
        this.link=link;
        set_action(); set_table1(); set_beto(); set_table2();
        scan();
    }
    public StringBuffer get_result(){
        return result;
    }


    private int sequence=1;
    private Vector link=new Vector();//存放单词序列
    private Vector language=new Vector();//存放待分析的单词序列
    private Vector string=new Vector();//变换后的待分析单词序列

    private Vector change_word=new Vector();//保存原变量名
    private Vector change_host=new Vector();//保存赋值语句左边的值
    private Vector change_cmp=new Vector();//保存原比较符

    private Vector out=new Vector();//存放四元组
    private StringBuffer result=new StringBuffer();//存放分析后的结果
    private int victory=0;//判断正误的标志

    private Stack state=new Stack();//状态堆栈
    private Stack sign=new Stack();//符号堆栈


    //构造ACTION表
    private String action[][]=new String[38][14];
    private void set_action(){
        for(int i=0;i<38;i++)
            for(int j=0;j<14;j++)
                action[i][j]=“ “;
        action[0][0]=“S3“;action[0][12]=“S4“;
        action[1][13]=“acc“;
        action[2][0]=“r14“;action[2][12]=“r14“;action[2][13]=“r14“;
        action[3][1]=“S6“;
        action[4][4]=“S7“;
        action[5][13]=“r1“;
        action[6][1]=“S12“;action[6][7]=“S9“;action[6][11]=“S11“;action[6][12]=“S13“;
        action[7][1]=“S12“;action[7][11]=“S11“;action[7][12]=“S13“;
        action[8][2]=“S15“;action[8][5]=“S16“;action[8][6]=“S17“;
        action[9][1]=“S12“;action[9][7]=“S9“;action[9][11]=“S11“;action[9][12]=“S13“;
        action[10][8]=“S19“;action[10][9]=“S20“;action[10][10]=“S21“;
        action[11][1]=“S12“;action[11][11]=“S11“;action[11][12]=“S13“;
        action[12][1]=“S12“;action[12][11]=“S11“;action[12][12]=“S13“;
        action[13][2]=“r13“;action[13][3]=“r13“;action[13][5]=“r13“;action[13][6]=“r13“;
        action[13][8]=“r13“;action[13][9]=“r13“;action[13][10]=“r13“;action[13][13]=“r13“;
        action[14][3]=“r4“;action[14][9]=“S20“;action[14][10]=“S21“;action[14][13]=“r4“;
        action[15][0]=“r14“;action[15][12]=“r14“;action[15][13]=“r14“;
        action[16][0]=“r14“;action[16][12]=“r14“;action[16][13]=“r14“;
        action[17][0]=“r14“;action[17][12]=“r14“;action[17][13]=“r14“;
        action[18][2]=“r7“;action[18][5]=“r7“;action[18][6]=“r7“;
        action[19][1]=“S12“;action[19][11]=“S11“;action[19][12]=“S13“;
        action[20][1]=“S12“;action[20][11]=“S11“;action[20][12]=“S13“;
        action[21][1]=“S12“;action[21][11]=“S11“;ac

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件          0  2009-06-19 17:03  ifelse\build\classes\.netbeans_automatic_build

     文件        609  2009-06-19 17:03  ifelse\build\classes\my\ifelse\Equation.class

     文件        370  2009-06-19 17:03  ifelse\build\classes\my\ifelse\Node.class

     文件        633  2009-06-19 17:03  ifelse\build\classes\my\ifelse\translate$TF_node.class

     文件        513  2009-06-19 17:03  ifelse\build\classes\my\ifelse\translate$two.class

     文件      14912  2009-06-19 17:03  ifelse\build\classes\my\ifelse\translate.class

     文件         95  2009-06-19 17:03  ifelse\build\classes\my\ifelse\translate.rs

     文件        730  2009-06-19 17:03  ifelse\build\classes\my\ifelse\window$1.class

     文件        730  2009-06-19 17:03  ifelse\build\classes\my\ifelse\window$2.class

     文件        730  2009-06-19 17:03  ifelse\build\classes\my\ifelse\window$3.class

     文件        527  2009-06-19 17:03  ifelse\build\classes\my\ifelse\window$4.class

     文件       6641  2009-06-19 17:03  ifelse\build\classes\my\ifelse\window.class

     文件       4995  2009-06-19 17:03  ifelse\build\classes\my\ifelse\word.class

     文件         32  2009-06-19 17:03  ifelse\build\classes\my\ifelse\word.rs

     文件       3713  2009-06-05 20:15  ifelse\build.xml

     文件      33198  2009-06-19 17:00  ifelse\dist\IfElse.jar

     文件       1445  2009-06-19 17:00  ifelse\dist\README.TXT

     文件         85  2009-06-05 20:15  ifelse\manifest.mf

     文件      34071  2009-06-05 20:15  ifelse\nbproject\build-impl.xml

     文件        455  2009-06-05 20:15  ifelse\nbproject\genfiles.properties

     文件        230  2009-06-05 20:15  ifelse\nbproject\private\private.properties

     文件        211  2009-06-20 12:48  ifelse\nbproject\private\private.xml

     文件       1908  2009-06-05 20:23  ifelse\nbproject\project.properties

     文件        576  2009-06-05 20:15  ifelse\nbproject\project.xml

     文件      17822  2009-06-19 08:35  ifelse\src\my\ifelse\translate.java

     文件       9919  2009-06-20 12:47  ifelse\src\my\ifelse\window.form

     文件       8822  2009-06-20 12:47  ifelse\src\my\ifelse\window.java

     文件       7878  2009-06-18 17:41  ifelse\src\my\ifelse\word.java

     文件        162  2009-07-03 15:10  ifelse\使用范例.txt

     目录          0  2009-07-03 15:02  ifelse\build\classes\my\ifelse

............此处省略14个文件信息

评论

共有 条评论