亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? simple.java

?? 一個(gè)用JAVA做的
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
            } else {                this.codeMemory[++this.currentCodePtr] = 4200;            }            this.needReScan[this.currentCodePtr][0] = nextLineNum;            this.needReScan[this.currentCodePtr][1] = this.currentLine;        } else if (currentNode.symbol.equals("endif")) {        } else if (currentNode.symbol.equals("while")) {            Node n1 = tokens.get(++currentPtr);            Node opt = tokens.get(++currentPtr);            Node n2 = tokens.get(++currentPtr);            //if n1 opt n2 .... endif            //n1 必須為整數(shù)或變量且已經(jīng)聲明過(guò)            //opt 為 <,>,==,<=,>= 中的一個(gè)            //n2 同n1            if(!(((n1.type.equals(Type.VARIABLE) && n1.where == 0 && this.symbolTable.contains(n1))|| n1.type == Type.NUM)                    && (opt.symbol.equals("==") || opt.symbol.equals(">")|| opt.symbol.equals("<") || opt.symbol.equals("<=") || opt.symbol.equals(">="))                    && ((n2.type == Type.VARIABLE && n2.where == 0 && this.symbolTable.contains(n2)) || n2.type == Type.NUM))) {                throw new Exception("Invalid condition in line " + this.currentLine);            }            if (n1.type == Type.VARIABLE) {                n1 = this.symbolTable.get(this.symbolTable.indexOf(n1));                this.codeMemory[++this.currentCodePtr] = 2000 + n1.location;            } else {                this.dataMemory[++this.currentNumPtr] = Integer.parseInt(n1.symbol);                this.codeMemory[++this.currentCodePtr] = 2000 + currentNumPtr;            }            if (n2.type == Type.VARIABLE) {                n2 = this.symbolTable.get(this.symbolTable.indexOf(n2));                this.codeMemory[++this.currentCodePtr] = 3100 + n2.location;            } else {                this.dataMemory[++this.currentNumPtr] = Integer.parseInt(n2.symbol);                this.codeMemory[++this.currentCodePtr] = 3100 + currentNumPtr;            }            int nextLineNum = getNextLineNum("endw","while");            if(opt.symbol.equals("==")) {                this.codeMemory[++this.currentCodePtr] = 4600;            } else if(opt.symbol.equals(">")) {                this.codeMemory[++this.currentCodePtr] = 4500;            } else if(opt.symbol.equals(">=")) {                this.codeMemory[++this.currentCodePtr] = 4100;            } else if(opt.symbol.equals("<")) {                this.codeMemory[++this.currentCodePtr] = 4400;            } else if(opt.symbol.equals("<=")) {                this.codeMemory[++this.currentCodePtr] = 4300;            } else {                this.codeMemory[++this.currentCodePtr] = 4200;            }            this.needReScan[this.currentCodePtr][0] = nextLineNum;            this.needReScan[this.currentCodePtr][1] = this.currentLine;        } else if (currentNode.symbol.equals("endw")) {            int lineToGo = this.getPreLineNum("while", "endw");            Node temp = new Node();            temp.symbol = String.valueOf(lineToGo);            temp.type = Type.LINE;            temp = this.symbolTable.get(this.symbolTable.indexOf(temp));            this.codeMemory[++this.currentCodePtr] = 4000 + temp.location;        } else if (currentNode.symbol.equals("for")) {            Node[] temp = new Node[7];            for(int i=0;i<7;++i)                temp[i] = this.tokens.get(++this.currentPtr);            if(!(((temp[2].type.equals(Type.VARIABLE) && temp[2].where == 0 && this.symbolTable.contains(temp[2]))|| temp[2].type == Type.NUM)                    && temp[0].type == Type.VARIABLE && temp[1].symbol.equals("=") && temp[3].symbol.equals("to")                    && ((temp[4].type == Type.VARIABLE && temp[4].where == 0 && this.symbolTable.contains(temp[4])) || temp[4].type == Type.NUM))) {                throw new Exception("Invalid expression in line " + this.currentLine);            }            int fLocation = this.symbolTable.indexOf(temp[0]);            if(fLocation == -1) {                throw new Exception(temp[0].symbol + " has been used without been decleared in line " + this.currentLine);            }            Node f = this.symbolTable.get(fLocation);            Node n1 = temp[2];            Node n2 = temp[4];            if (n1.type == Type.VARIABLE) {                n1 = this.symbolTable.get(this.symbolTable.indexOf(n1));                this.codeMemory[++this.currentCodePtr] = 2000 + n1.location;                this.codeMemory[++this.currentCodePtr] = 2100 + f.location;            } else {                this.dataMemory[++this.currentNumPtr] = Integer.parseInt(n1.symbol);                this.codeMemory[++this.currentCodePtr] = 2000 + currentNumPtr;                this.codeMemory[++this.currentCodePtr] = 2100 + f.location;            }            if (n2.type == Type.VARIABLE) {                try {                    n2 = this.symbolTable.get(this.symbolTable.indexOf(n2));                } catch (Exception e) {                    throw new Exception(n2.symbol + " has been used without been decleared in line " + this.currentLine);                }            } else {                this.dataMemory[++this.currentNumPtr] = Integer.parseInt(n2.symbol);                n2.location = this.currentNumPtr;            }            Node n3;            if(temp[5].symbol.equals("step")) {                if(temp[6].type == Type.NUM) {                    this.dataMemory[++this.currentNumPtr] = Integer.parseInt(temp[6].symbol);                    temp[6].location = this.currentNumPtr;                    n3 = temp[6];                } else if (temp[6].type == Type.VARIABLE) {                    try {                        temp[6] = this.symbolTable.get(this.symbolTable.indexOf(temp[6]));                        n3 = temp[6];                    } catch (Exception e) {                        throw new Exception(temp[6].symbol + " has been used without been decleared in line " + this.currentLine);                    }                } else {                    throw new Exception("Invalid step num " + temp[6].symbol + "in line " + this.currentLine);                }            } else {                this.currentPtr -= 2;                n3 = new Node();                this.dataMemory[++this.currentNumPtr] = 1;                n3.location = this.currentNumPtr;            }            this.codeMemory[++this.currentCodePtr] = 2000 + n2.location;            this.codeMemory[++this.currentCodePtr] = 3100 + f.location;            int nextLineNum = this.getNextLineNum("next", "for");            this.codeMemory[++this.currentCodePtr] = 4100;            this.needReScan[this.currentCodePtr][0] = nextLineNum;            this.needReScan[this.currentCodePtr][1] = this.currentLine;            this.codeMemory[++this.currentCodePtr] = 2000 + f.location;            this.codeMemory[++this.currentCodePtr] = 3000 + n3.location;            this.codeMemory[++this.currentCodePtr] = 2100 + f.location;        } else if (currentNode.symbol.equals("next")) {            int location = this.getPreLineNum("for", "next");            Node temp = new Node();            temp.symbol = String.valueOf(location);            temp.type = Type.LINE;            temp = this.symbolTable.get(this.symbolTable.indexOf(temp));            this.codeMemory[++this.currentCodePtr] = 4000 + temp.location + 2;        } else if(currentNode.symbol.equals("let")) {            Node y = tokens.get(++currentPtr);            Node equ = tokens.get(++currentPtr);            try {                y = this.symbolTable.get(this.symbolTable.indexOf(y));            }catch (Exception e) {                throw new Exception(y.symbol + " has been used without beed decleared. in line " + this.currentLine);            }            if(!equ.symbol.equals("=")) {                throw new Exception("'=' is expected here,but we get " + equ.symbol + " in line " + this.currentLine);            }            List<Node> infix = new LinkedList<Node>();            Node temp = null;            do {                try {                    temp = tokens.get(++currentPtr);                    infix.add(temp);                }catch (Exception e) {                      //防止讀過(guò)頭了,當(dāng)let語(yǔ)句為程序最后一句時(shí),會(huì)出現(xiàn)                }            } while(temp.type != Type.LINE);            infix.remove(infix.size() - 1);            --currentPtr;            Node result = this.dealExpression(infix);            this.codeMemory[++this.currentCodePtr] = 2000 + result.location;            this.codeMemory[++this.currentCodePtr] = 2100 + y.location;        } else {            throw new Exception("Unexpect symbol " + currentNode.symbol + " appeared in line " + this.currentLine);        }    }    //對(duì)表達(dá)式的處理    private Node dealExpression (List<Node> infix) throws Exception{        List<Node> postfix = this.convertToPostfix(infix);        Stack<Node> stack = new Stack<Node>();        for(int i=0;i<postfix.size();++i) {            Node current = postfix.get(i);             if(current.type == Type.NUM) {                 this.dataMemory[++this.currentNumPtr] = Integer.parseInt(current.symbol);                 current.location = this.currentNumPtr;                 stack.push(current);             } else if(current.type == Type.VARIABLE) {                 try {                     current = this.symbolTable.get(this.symbolTable.indexOf(current));                     stack.push(current);                 } catch (Exception e) {                     throw new Exception(current.symbol + " in Expression undecleared in line " + this.currentFile);                 }             } else if(isOperator(current)) {                 Node n2 = stack.pop();                 Node n1 = stack.pop();                 Node result = calculator(n1,n2,current);                 stack.push(result);             } else {                throw new Exception("Invalid expression in line " + this.currentLine);             }        }        return stack.pop();    }    //計(jì)算n1 opt n2的結(jié)果,并返回Node值    private Node calculator(Node n1,Node n2,Node opt) throws Exception {        Node result = new Node();        this.codeMemory[++this.currentCodePtr] = 2000 + n1.location;        if(opt.symbol.equals("+")) {            this.codeMemory[++this.currentCodePtr] = 3000 + n2.location;        } else if(opt.symbol.equals("-")) {            this.codeMemory[++this.currentCodePtr] = 3100 + n2.location;        } else if(opt.symbol.equals("*")) {            this.codeMemory[++this.currentCodePtr] = 3300 + n2.location;        } else if(opt.symbol.equals("/")) {            this.codeMemory[++this.currentCodePtr] = 3200 + n2.location;        } else if(opt.symbol.equals("^")) {            this.codeMemory[++this.currentCodePtr] = 3500 + n2.location;        } else if(opt.symbol.equals("%")) {            this.codeMemory[++this.currentCodePtr] = 3400 + n2.location;        } else {            throw new Exception ("Unsupported operator " + opt.symbol + "int line " + this.currentLine);        }        //分配一個(gè)內(nèi)存位置給中間結(jié)果        ++this.currentNumPtr;        this.codeMemory[++this.currentCodePtr] = 2100 + this.currentNumPtr;        result.location = this.currentNumPtr;        return result;    }    //將中綴式生成對(duì)應(yīng)的后綴式    private List<Node> convertToPostfix (List<Node> infix) throws Exception {        Stack<Node> stack = new Stack<Node>();        List<Node> postfix = new LinkedList<Node>();        Node temp = new Node();        temp.symbol = "(";        temp.type = Type.KEYWORD;        stack.push(temp);        temp = new Node();        temp.symbol = ")";        temp.type = Type.KEYWORD;        infix.add(temp);        int ptr = 0;        try {            while (!stack.empty()) {                Node current = infix.get(ptr);                if(current.type == Type.NUM || current.type == Type.VARIABLE) {                    postfix.add(current);                } else if(current.symbol.equals("(")) {                    stack.push(current);                } else if(isOperator(current)) {                    if(isOperator(stack.peek()) && isLarger(stack.peek(),current)) {                        postfix.add(stack.pop());                    }                    stack.push(current);                } else if(current.symbol.equals(")")) {                    Node top = stack.pop();                    while(!top.symbol.equals("(")) {                        postfix.add(top);                        top = stack.pop();                    }                }                ++ptr;            }        } catch (Exception e) {            throw new Exception("Invalid expression in line " + this.currentLine);        }        return postfix;    }    private boolean isOperator(Node node) {        return node.symbol.equals("+") || node.symbol.equals("-") || node.symbol.equals("*")                || node.symbol.equals("/") || node.symbol.equals("%") || node.symbol.equals("^");    }    private boolean isLarger(Node opt1,Node opt2) {        return this.getPRI(opt1) > this.getPRI(opt2);    }    private int getPRI(Node opt) {        if(opt.symbol.equals("+") || opt.symbol.equals("-")) {            return 1;        } else if(opt.symbol.equals("^")) {            return 4;        } else if(opt.symbol.equals("*") || opt.symbol.equals("/") || opt.symbol.equals("%")) {            return 2;        } else {            throw new RuntimeException();        }    }    private void reScan() throws Exception {        for(int line = 0; line < 100; ++line) {            if(this.needReScan[line][0] != -1) {                Node temp = new Node();                temp.type = Type.LINE;                temp.symbol = String.valueOf(this.needReScan[line][0]);                int location = this.symbolTable.indexOf(temp);                if(location == -1)                    throw new Exception("The line num " + this.needReScan[line][0] + " int line "                            + this.needReScan[line][1] + " is not exist.");                temp = this.symbolTable.get(location);                this.codeMemory[line] += temp.location;            }        }    }    private void dealLine(Node currentNode) throws Exception {        this.currentLine = Integer.parseInt(currentNode.symbol);        currentNode.location = this.currentCodePtr + 1;        this.symbolTable.add(currentNode);    }    private void iniMemory() {        for (int i = 0; i < 100; ++i) {            dataMemory[i] = 0;            codeMemory[i] = 0;            needReScan[i][0] = -1;            stringMemory[i / 2] = null;        }    }    private int[][] needReScan = new int[100][2];    private List<Node> tokens;    private List<Node> symbolTable;           //存放聲明的變量及行號(hào)    private int[] dataMemory = new int[100];    private int[] codeMemory = new int[100];    private String[] stringMemory = new String[50];    private String currentFile;    private int currentLine = -1;         //源程序中當(dāng)前的代碼行    private int currentPtr = -1;          //指向讀頭下的token    private int currentCodePtr;           //生成的語(yǔ)句存放的位置    private int currentNumPtr;            //整數(shù)在內(nèi)存中的位置    private int currentStringPtr;         //字符串在內(nèi)存中的位置    /*     *是否已經(jīng)編譯過(guò)    */    private boolean compiled = false;    //程序是否包含"end",若不包含,則生成的目標(biāo)代碼會(huì)發(fā)生運(yùn)行時(shí)錯(cuò)誤    private boolean hasEndSymbol = false;    private Lexical lex;}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡电影免费在线播放一区| 亚洲大片精品永久免费| 国产精品一品二品| 久久久.com| 成人午夜视频在线观看| 国产精品精品国产色婷婷| 99精品国产视频| 亚洲一区二区中文在线| 欧美无砖专区一中文字| 日韩一区欧美二区| 日韩欧美的一区| 成人免费视频播放| 亚洲综合免费观看高清完整版| 欧美性感一类影片在线播放| 麻豆极品一区二区三区| 亚洲国产高清在线观看视频| 色综合久久综合| 天堂在线一区二区| 精品对白一区国产伦| 成人蜜臀av电影| 亚洲成人免费电影| 欧美mv和日韩mv的网站| 粉嫩在线一区二区三区视频| 亚洲午夜免费电影| 久久伊人中文字幕| aa级大片欧美| 日韩激情视频网站| 国产精品久久久久aaaa| 欧美浪妇xxxx高跟鞋交| 国产一区视频网站| 亚洲精品免费看| 日韩欧美精品三级| 一本大道综合伊人精品热热| 老司机免费视频一区二区| 中文久久乱码一区二区| 欧美日本一区二区三区四区| 国产盗摄精品一区二区三区在线| 一区二区三区在线播| 久久影视一区二区| 欧美三级一区二区| 成人综合婷婷国产精品久久蜜臀| 午夜影院久久久| 国产精品国产馆在线真实露脸| 欧美一区二区三区的| 95精品视频在线| 国产一区欧美二区| 日日欢夜夜爽一区| 亚洲色大成网站www久久九九| 精品久久99ma| 欧美日韩国产免费一区二区| 99久久精品久久久久久清纯| 激情深爱一区二区| 亚洲成人第一页| 日韩毛片在线免费观看| 国产亚洲精品aa午夜观看| 欧美电影在哪看比较好| 91麻豆视频网站| 国产乱人伦偷精品视频免下载 | 欧美日韩在线三区| 成人黄色免费短视频| 久久99精品国产.久久久久久| 午夜欧美电影在线观看| 一区二区三区欧美日韩| 中文字幕乱码久久午夜不卡| 久久亚洲精精品中文字幕早川悠里 | 精品一区二区在线播放| 亚洲主播在线观看| 亚洲精品视频在线| 一区在线观看视频| 国产精品久久久久一区 | 国产精品99久久久久久宅男| 久久精品久久久精品美女| 日韩激情av在线| 天堂va蜜桃一区二区三区| 亚洲激情图片一区| 亚洲精品大片www| 亚洲欧美一区二区三区久本道91 | 精品美女在线播放| 制服视频三区第一页精品| 欧美日韩国产区一| 欧美日韩国产综合视频在线观看| 日本乱码高清不卡字幕| 91免费视频观看| 91成人免费网站| 91黄色免费版| 欧美日韩国产一级片| 欧美精品在线一区二区| 欧美男女性生活在线直播观看| 欧美日韩久久一区二区| 欧美一区二区三级| 日韩欧美国产综合| 久久午夜国产精品| 日本一区二区三区久久久久久久久不| 久久久三级国产网站| 国产欧美日韩一区二区三区在线观看| 欧美国产精品一区二区| 国产精品国产a级| 一区二区高清在线| 肉肉av福利一精品导航| 韩国女主播一区| eeuss鲁片一区二区三区| 99久久精品一区| 欧美在线观看一二区| 日韩欧美综合在线| 国产日产精品一区| 一区二区三区欧美在线观看| 免费成人美女在线观看.| 国产激情精品久久久第一区二区 | 天天亚洲美女在线视频| 免费在线观看一区| 成人av资源网站| 欧美熟乱第一页| 欧美精品一区二区三区在线播放| 中文在线资源观看网站视频免费不卡| 亚洲影院理伦片| 久久成人精品无人区| caoporn国产精品| 欧美一区二区成人| 国产精品久久久久aaaa樱花| 日韩电影免费在线| 国产成人av电影在线| 欧美网站大全在线观看| 久久综合视频网| 亚洲mv在线观看| 懂色av一区二区三区免费观看| 精品视频一区三区九区| 久久―日本道色综合久久| 樱桃视频在线观看一区| 国产精品影视在线观看| 欧美揉bbbbb揉bbbbb| 久久久久久久久久久99999| 一区二区三区不卡在线观看| 国产剧情在线观看一区二区| 欧美日韩中文字幕一区| 国产精品美女久久福利网站| 蜜乳av一区二区| 欧洲生活片亚洲生活在线观看| 久久久久国产精品人| 亚洲成人tv网| 91国偷自产一区二区使用方法| 精品国产伦一区二区三区观看体验 | 亚洲va中文字幕| 粉嫩绯色av一区二区在线观看 | 亚洲免费观看高清完整| 国精产品一区一区三区mba视频| 欧美性视频一区二区三区| 国产精品嫩草久久久久| 精品综合免费视频观看| 欧美日韩中文字幕一区| 亚洲美女视频在线| 国产福利不卡视频| 日韩欧美中文字幕精品| 亚洲成人午夜电影| 99久久精品国产导航| 久久久综合九色合综国产精品| 日韩高清电影一区| 欧美中文字幕一区| 亚洲欧美日韩精品久久久久| av一区二区三区在线| 久久久久久夜精品精品免费| 裸体歌舞表演一区二区| 337p亚洲精品色噜噜| 亚洲风情在线资源站| 色婷婷综合久色| 国产精品第13页| 成人高清av在线| 中文字幕一区免费在线观看| 不卡的av在线| 国产精品美女久久福利网站| caoporn国产精品| 亚洲日本电影在线| 99精品桃花视频在线观看| 成人欧美一区二区三区在线播放| 91美女视频网站| 亚洲精品国产成人久久av盗摄| 色偷偷久久一区二区三区| 亚洲乱码中文字幕| 欧洲国产伦久久久久久久| 亚洲444eee在线观看| 制服丝袜成人动漫| 捆绑变态av一区二区三区| 2021国产精品久久精品| 国产成人在线观看免费网站| 国产精品卡一卡二| 色8久久人人97超碰香蕉987| 亚洲18女电影在线观看| 欧美一二三在线| 国产乱码精品一区二区三区忘忧草| 久久伊人蜜桃av一区二区| 床上的激情91.| 精品三级在线看| 亚洲大片一区二区三区| 欧美日韩国产影片| 三级在线观看一区二区| 久久日一线二线三线suv| 国内成人自拍视频| 日韩一区二区三区免费看| 国产黑丝在线一区二区三区| 欧美国产日韩亚洲一区| 色偷偷久久一区二区三区|