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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? simple.java

?? 一個用JAVA做的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package srtpv02;import java.io.File;import java.io.FileWriter;import java.io.IOException;import java.io.Writer;import java.util.ArrayList;import java.util.Collection;import java.util.HashSet;import java.util.LinkedList;import java.util.List;import java.util.Set;import java.util.Stack;/** * * @author Administrator */public class Simple {    public String compile(String fileName) {        lex = new Lexical(fileName);        currentFile = fileName;        this.hasEndSymbol = false;        try {            lex.run();            tokens = lex.getTokens();            this.iniMemory();            this.analyse();            this.reScan();        } catch (Exception e) {            return e.getMessage();        }        try {        this.outCode();        this.outData();        this.outSData();        } catch (Exception e) {            return "寫入到目標文件時發生錯誤";        }        if(!this.hasEndSymbol){            return "The program does not have end symbol, this will cause runntime error.";        }        return "Congratulations! Complie succeed...";    }    public void run() {        if (!compiled) {            return;        }    }    private int getNextLineNum(String want, String ignore) {        int needIgnore = 0;        for (int next = this.currentPtr + 1; next < this.tokens.size(); ++next) {            Node node = this.tokens.get(next);            if (node.symbol.equals(ignore)) {                ++needIgnore;            } else if (node.symbol.equals(want))  {                if (needIgnore == 0) {                    Node ppLineNum = this.tokens.get(++next);                    if(ppLineNum.type == Type.LINE)                        return Integer.parseInt(ppLineNum.symbol);                    else                        return -1;                } else {                    --needIgnore;                }            }        }        return -1;    }    private int getPreLineNum(String want, String ignore) {        int needIgnore = 0;        for (int pre = this.currentPtr - 1; pre >= 0 ; --pre) {            Node node = this.tokens.get(pre);            if (node.symbol.equals(ignore)) {                ++needIgnore;            } else if (node.symbol.equals(want))  {                if (needIgnore == 0) {                    Node ppLineNum = this.tokens.get(--pre);                    if(ppLineNum.type == Type.LINE)                        return Integer.parseInt(ppLineNum.symbol);                    else                        return -1;                } else {                    --needIgnore;                }            }        }        return -1;    }    private void outData() throws Exception {        File data = new File(this.currentFile + ".mem");        Writer writer = new FileWriter(data);        for(int num : this.dataMemory) {            writer.write("" + num + "\n");        }        data.createNewFile();        writer.flush();        writer.close();    }    private void outSData() throws Exception {        File data = new File(this.currentFile + ".smem");        Writer writer = new FileWriter(data);        for (String string : this.stringMemory) {            writer.write(string + "\n");        }        data.createNewFile();        writer.flush();        writer.close();    }    private void outCode() throws Exception {        File data = new File(this.currentFile + ".code");        Writer writer = new FileWriter(data);        for (int num : this.codeMemory) {            writer.write("" + num + "\n");        }        data.createNewFile();        writer.flush();        writer.close();    }    private void analyse() throws Exception {        symbolTable = new ArrayList<Node>();        currentLine = -1;        this.currentStringPtr = -1;        this.currentNumPtr = -1;        this.currentCodePtr = -1;        for (currentPtr = 0; currentPtr < tokens.size(); ++currentPtr) {            Node current = tokens.get(currentPtr);            switch (current.type) {                case LINE:                    dealLine(current);                    break;                case KEYWORD:                    dealKeyWord(current);                    break;                /*case VARIABLE:                dealVariable(current);                break;                case STRING:                dealString(current);                break;                case NUM:                dealNum(current);                break;*/                default:                    throw new Exception(current.symbol + " in line " +                            currentLine + " is wrong!");            }        }    }    private void dealKeyWord(Node currentNode) throws Exception {        if (currentNode.symbol.equals("rem")) {            while (true) {                if (tokens.get(++currentPtr).type.equals(Type.LINE)) {                    break;                }            }            --currentPtr;            return;        } else if (currentNode.symbol.equals("input")) {            Node temp = tokens.get(++currentPtr);            int location = this.symbolTable.indexOf(temp);            if (location != -1) {                temp = this.symbolTable.get(location);                if(temp.where == 0) {                    this.codeMemory[++this.currentCodePtr] = 1000 + temp.location;                    return;                } else {                    this.codeMemory[++this.currentCodePtr] = 1200 + temp.location;                    return;                }            } else {                throw new Exception(temp.symbol + " has been used without been defined in line" + this.currentLine);            }        } else if (currentNode.symbol.equals("print")) {            Node temp = tokens.get(++currentPtr);            if (temp.type.equals(Type.VARIABLE)) {                int location = this.symbolTable.indexOf(temp);                if (location != -1) {                    temp = this.symbolTable.get(location);                    if (temp.where == 0) {                        this.codeMemory[++this.currentCodePtr] = 1100 + temp.location;                        return;                    } else {                        this.codeMemory[++this.currentCodePtr] = 1300 + temp.location;                        return;                    }                } else {                    throw new Exception(temp.symbol + " has not been defined in line" + this.currentLine);                }            } else if(temp.type.equals(Type.NUM)){                this.dataMemory[++this.currentNumPtr] = Integer.parseInt(temp.symbol);                this.codeMemory[++this.currentCodePtr] = 1100 + this.currentNumPtr;            } else if(temp.type.equals(Type.STRING)) {                this.stringMemory[++this.currentStringPtr] = temp.symbol;                this.codeMemory[++this.currentCodePtr] = 1300 + this.currentStringPtr;            } else {            }        } else if (currentNode.symbol.equals("string")) {            Node temp = tokens.get(++currentPtr);            if(this.symbolTable.contains(temp)) {                throw new Exception(temp.symbol + " has already been defined.");            }            temp.where = 1;            //this.stringMemory[++this.currentStringPtr] = temp.symbol;            //記錄存放在內存中的位置,并將此變量放入符號表            temp.location = ++this.currentStringPtr;            this.symbolTable.add(temp);            //如果下一個符號是 = ,則說明是聲明的同時進行了初始化,將此值放入內存            Node valueTemp = tokens.get(currentPtr + 1);            if(valueTemp.symbol.equals("=")) {                currentPtr += 2;                valueTemp = tokens.get(currentPtr);                if(!valueTemp.type.equals(Type.STRING))                    throw new Exception(valueTemp.symbol + " is not valid value for " + temp.symbol);                this.stringMemory[this.currentStringPtr] = valueTemp.symbol;            }            return;        } else if (currentNode.symbol.equals("int")) {            Node temp = tokens.get(++currentPtr);            if (symbolTable.contains(temp)) {                throw new Exception(temp.symbol + " has already been defined");            }            temp.where = 0;            //this.dataMemory[++this.currentNumPtr] = Integer.parseInt(temp.symbol);            temp.location = ++this.currentNumPtr;            this.symbolTable.add(temp);            Node valueTemp = tokens.get(currentPtr + 1);            if(valueTemp.symbol.equals("=")) {                currentPtr += 2;                valueTemp = tokens.get(currentPtr);                if (!valueTemp.type.equals(Type.NUM)) {                    throw new Exception(valueTemp.symbol + " is not valid value for " + temp.symbol);                }                this.dataMemory[this.currentNumPtr] = Integer.parseInt(valueTemp.symbol);            }        } else if (currentNode.symbol.equals("gosub")) {            Node temp = tokens.get(++currentPtr);            if(!temp.type.equals(Type.NUM)) {                throw new Exception("The gosub must followed with a num in line " + this.currentLine);            }            temp.type = Type.LINE;            int locationInTable = symbolTable.indexOf(temp);            if(locationInTable != -1) {                temp = tokens.get(locationInTable);                this.codeMemory[++this.currentCodePtr] = 5200 + temp.location;                return;            } else {                this.codeMemory[++this.currentCodePtr] = 5200;                this.needReScan[this.currentCodePtr][0] = Integer.parseInt(temp.symbol);                this.needReScan[this.currentCodePtr][1] = this.currentLine;                return;            }        } else if (currentNode.symbol.equals("return")) {            this.codeMemory[++this.currentCodePtr] = 5300;        } else if (currentNode.symbol.equals("end")) {            this.codeMemory[ ++  this.currentCodePtr] = 8000;            this.hasEndSymbol = true;        } else if (currentNode.symbol.equals("goto")) {            Node temp = tokens.get(++currentPtr);            if(!temp.type.equals(Type.NUM)) {                throw new Exception("The goto must followed with a num in line " + this.currentLine);            }            temp.type = Type.LINE;            int locationInTable = symbolTable.indexOf(temp);            if(locationInTable != -1) {                temp = tokens.get(locationInTable);                this.codeMemory[++this.currentCodePtr] = 4000 + temp.location;                return;            } else {                this.codeMemory[++this.currentCodePtr] = 4000;                this.needReScan[this.currentCodePtr][0] = Integer.parseInt(temp.symbol);                this.needReScan[this.currentCodePtr][1] = this.currentLine;                return;            }        } else if (currentNode.symbol.equals("if")) {            Node n1 = tokens.get(++currentPtr);            Node opt = tokens.get(++currentPtr);            Node n2 = tokens.get(++currentPtr);            //if n1 opt n2 .... endif            //n1 必須為整數或變量且已經聲明過            //opt 為 <,>,==,<=,>= 中的一個            //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("Valid 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("endif","if");            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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频一二三区| 国产日韩欧美精品一区| 国产日韩精品视频一区| 亚洲视频在线一区二区| 青青青伊人色综合久久| 成人久久视频在线观看| 7777精品伊人久久久大香线蕉的| 久久久影院官网| 午夜久久久影院| 国产精品99久久久| 欧美日韩中字一区| 国产人久久人人人人爽| 亚洲国产成人91porn| 56国语精品自产拍在线观看| 中文字幕二三区不卡| 蜜桃精品在线观看| 日本高清视频一区二区| 国产亚洲精品7777| 午夜精品福利在线| 99国产精品一区| 欧美videossexotv100| 亚洲精品成人悠悠色影视| 国产综合成人久久大片91| 欧美午夜宅男影院| 亚洲欧洲性图库| 久久99热这里只有精品| 欧美视频中文一区二区三区在线观看| 久久欧美一区二区| 青青草精品视频| 欧美色综合影院| 亚洲精品欧美在线| 国产一区 二区 三区一级| 欧美高清精品3d| 一区二区三区高清不卡| 懂色av中文字幕一区二区三区| 欧美videos大乳护士334| 天堂久久久久va久久久久| 一本久久a久久精品亚洲| 国产亚洲欧美日韩俺去了| 久久av老司机精品网站导航| 欧美日韩不卡一区二区| 亚洲精品高清视频在线观看| 成人午夜电影网站| 精品sm捆绑视频| 青青青爽久久午夜综合久久午夜| 欧美色视频在线观看| 亚洲视频你懂的| 成人黄页毛片网站| 国产视频一区在线播放| 久久黄色级2电影| 欧美一区二区三区四区久久| 亚洲成人精品在线观看| 色综合天天在线| 亚洲人成在线观看一区二区| 成人午夜碰碰视频| 国产精品三级久久久久三级| 国产精品乡下勾搭老头1| 久久久久久久综合狠狠综合| 狠狠色丁香久久婷婷综合丁香| 视频在线观看一区| 欧美日韩国产bt| 日韩av网站免费在线| 欧美人动与zoxxxx乱| 天天亚洲美女在线视频| 91精品国产欧美一区二区| 日本伊人色综合网| 日韩精品一区在线观看| 麻豆精品新av中文字幕| 精品国产免费一区二区三区四区| 久久97超碰色| 久久日韩粉嫩一区二区三区| 国产福利电影一区二区三区| 久久久精品影视| 国产v综合v亚洲欧| 亚洲国产成人一区二区三区| 99久久久精品| 夜夜精品视频一区二区| 欧美日韩国产影片| 日本成人在线看| 精品免费99久久| 国产成人av电影在线观看| 欧美激情在线免费观看| 91亚洲精品久久久蜜桃| 亚洲综合另类小说| 91精品久久久久久蜜臀| 久久国产精品一区二区| 国产日韩欧美综合一区| 99免费精品视频| 亚洲国产精品一区二区www在线| 欧美日韩国产一区| 国内精品久久久久影院色| 国产精品天天摸av网| 欧美最新大片在线看 | 成人avav在线| 91碰在线视频| 性久久久久久久久久久久| 精品国产a毛片| www.亚洲在线| 午夜电影网一区| 欧美精品一区二区三区在线 | 精品国产免费人成电影在线观看四季| 国产乱子伦视频一区二区三区| 国产精品视频在线看| 欧美日韩一区久久| 久久99精品国产麻豆不卡| 日本一区二区免费在线| 91久久香蕉国产日韩欧美9色| 青青草视频一区| 中文字幕一区二区三区蜜月| 欧美精品在线观看播放| 国产精品一区二区视频| 亚洲精品日日夜夜| 欧美videos大乳护士334| 99久久er热在这里只有精品66| 午夜视频一区二区| 久久精品一区二区| 欧美性一区二区| 国产精品自在在线| 在线日韩av片| 国产自产2019最新不卡| 一区二区视频免费在线观看| 欧美xxxx在线观看| 91福利视频在线| 国产成人鲁色资源国产91色综| 一区二区三区在线观看网站| 精品久久久久久综合日本欧美| 91玉足脚交白嫩脚丫在线播放| 免费观看成人av| 亚洲日本一区二区三区| 久久久久久久免费视频了| 欧美日本不卡视频| 成人免费视频一区二区| 免费在线看一区| 亚洲综合一区二区| 国产欧美精品一区| 欧美一级生活片| 一本大道av一区二区在线播放| 韩国午夜理伦三级不卡影院| 亚洲图片有声小说| 中文字幕在线不卡一区| 久久一二三国产| 88在线观看91蜜桃国自产| 91香蕉视频在线| 国产在线播放一区三区四| 一区二区成人在线| 国产精品丝袜久久久久久app| 青青草国产精品亚洲专区无| 亚洲精品一二三区| 国产精品情趣视频| 337p粉嫩大胆色噜噜噜噜亚洲 | 在线91免费看| 欧美亚洲一区三区| 91欧美激情一区二区三区成人| 国产精品69久久久久水密桃| 蜜臀av一区二区在线免费观看 | 色综合视频一区二区三区高清| 久久精品国产免费看久久精品| 亚洲自拍偷拍麻豆| 亚洲视频一区二区在线观看| 国产精品欧美久久久久一区二区| 26uuu精品一区二区在线观看| 91麻豆精品国产91久久久久| 欧美在线三级电影| 一本到高清视频免费精品| 成人丝袜高跟foot| 风间由美中文字幕在线看视频国产欧美 | 欧美日韩在线亚洲一区蜜芽| 成人免费毛片app| 国产91综合网| 国产成人精品综合在线观看| 久久精品国产秦先生| 亚洲成人综合视频| 亚洲超碰精品一区二区| 亚洲国产一区二区在线播放| 亚洲中国最大av网站| 亚洲激情欧美激情| 亚洲一区在线观看网站| 亚洲女人****多毛耸耸8| 亚洲欧美视频在线观看| 亚洲美女淫视频| 亚洲综合丝袜美腿| 亚洲成人资源在线| 肉肉av福利一精品导航| 日本不卡不码高清免费观看| 免费在线视频一区| 黄一区二区三区| 国产在线播精品第三| 成人免费av在线| 色综合天天综合网天天看片| 在线影院国内精品| 精品视频在线免费看| 欧美日韩成人综合在线一区二区 | 久久99精品久久久久久| 狠狠色伊人亚洲综合成人| 久久亚洲精华国产精华液| 久久久综合激的五月天| 国产精品久99| 亚洲综合色网站| 男女男精品视频网| 国产999精品久久久久久绿帽|