資源簡介
完整cmm解釋器構造實踐 二 詞法分析對應源代碼 參看http: blog csdn net shaw1994 article details 43057129
代碼片段和文件信息
package?com.shaw.cmmjava;
import?java.io.BufferedReader;
import?java.io.IOException;
import?java.util.linkedList;
import?com.shaw.cmmjava.model.Token;
public?class?Lexer?{
????private?static?BufferedReader?mBufferedReader;
????private?static?int?currentInt;
????private?static?char?currentChar;
????private?static?int?lineNo;
????
????public?static?linkedList?lexicalAnalyse(BufferedReader?br)?throws?IOException?{
????????lineNo?=?1;
????????mBufferedReader?=?br;
????????linkedList?tokenList?=?new?linkedList();
????????StringBuilder?sb?=?new?StringBuilder();
????????readChar();
????????while(currentInt?!=?-1)?{
????????????//消耗空白字符
????????????if?(currentChar?==?‘\n‘
????????????????????||?currentChar?==?‘\r‘
????????????????????||?currentChar?==?‘\t‘
?????????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-01-23?18:10??cmmjava_lexer\
?????文件?????????226??2015-01-23?17:53??cmmjava_lexer\.classpath
?????文件?????????372??2015-01-23?17:50??cmmjava_lexer\.project
?????目錄???????????0??2015-01-23?17:50??cmmjava_lexer\src\
?????目錄???????????0??2015-01-23?17:50??cmmjava_lexer\src\com\
?????目錄???????????0??2015-01-23?17:50??cmmjava_lexer\src\com\shaw\
?????目錄???????????0??2015-01-23?17:59??cmmjava_lexer\src\com\shaw\cmmjava\
?????文件????????8086??2015-01-23?17:20??cmmjava_lexer\src\com\shaw\cmmjava\Lexer.java
?????文件?????????680??2015-01-23?18:07??cmmjava_lexer\src\com\shaw\cmmjava\Main.java
?????目錄???????????0??2015-01-23?17:51??cmmjava_lexer\src\com\shaw\cmmjava\model\
?????文件????????6814??2015-01-23?16:54??cmmjava_lexer\src\com\shaw\cmmjava\model\Token.java
?????文件?????????933??2015-01-23?17:57??cmmjava_lexer\src\com\shaw\cmmjava\Util.java
?????目錄???????????0??2015-01-23?18:10??cmmjava_lexer\可執行jar\
?????文件????????6718??2015-01-23?18:07??cmmjava_lexer\可執行jar\lexer.jar
?????文件??????????32??2015-01-23?18:10??cmmjava_lexer\可執行jar\用法.txt
- 上一篇:基于51單片機的音樂盒設計
- 下一篇:學生信息管理系統 實驗報告
評論
共有 條評論