系統識別號 | U0002-0806200615061400 |
---|---|
DOI | 10.6846/TKU.2006.01022 |
論文名稱(中文) | Java語法樹與直譯機制 |
論文名稱(英文) | Syntax Tree and Interpreting Mechanism for Java Language |
第三語言論文名稱 | |
校院名稱 | 淡江大學 |
系所名稱(中文) | 資訊管理學系碩士班 |
系所名稱(英文) | Department of Information Management |
外國學位學校名稱 | |
外國學位學院名稱 | |
外國學位研究所名稱 | |
學年度 | 94 |
學期 | 2 |
出版年 | 95 |
研究生(中文) | 郭肇安 |
研究生(英文) | Chao-An Kuo |
學號 | 692521429 |
學位類別 | 碩士 |
語言別 | 繁體中文 |
第二語言別 | |
口試日期 | 2006-05-20 |
論文頁數 | 61頁 |
口試委員 |
指導教授
-
廖賀田(htliaw@mail.im.tku.edu.tw)
委員 - 李慶長 委員 - 呂芳懌 |
關鍵字(中) |
Java 語法樹 直譯器 |
關鍵字(英) |
Java Syntax tree Interpreter |
第三語言關鍵字 | |
學科別分類 | |
中文摘要 |
在傳統Java 程式的環境下,程式員若需執行Java 程式,都必須將原始碼編譯為位元組碼,再交由Java 虛擬機解譯執行。編譯後的位元組碼只是模擬原始碼的一種虛擬機器語言,與原始碼之間並沒有任何先天的關連性。 本論文提出對Java 語言的直譯機制,透過此機制我們不需將原始碼編譯為位元組碼,而是將原始碼轉成語法樹結構。透過樹狀節點所配置的虛擬函數,以遞迴呼叫直接執行原始碼的語意。 由於本直譯機制是採用遞迴呼叫的方式來完成,在遇到return 敘述、break 敘述與continue 敘述時,僅能跳離單一層級的遞迴呼叫,無法跳離多層級的遞迴呼叫。本論文採用try/catch 技術來突破因遞迴呼叫導致return 敘述、break 敘述與continue 敘述無法脫離深層遞迴的問題。 在進行再造工程時,若採用Java 原始碼轉為語法樹結構,可利用語法樹的樹狀運動來完成再造工程。 |
英文摘要 |
In the Java environment, source codes are compiled into bytecodes and executed by the Java Virtual Machine. Bytecodes are opcodes for Java Virtual Machine that simulates source codes. There is no significant relationship between Java source codes and bytecodes. This thesis proposed an interpreting mechanism for Java language. Without compiling source codes into bytecodes, a syntax tree is presented. The source codes are parsed into syntax tree and executed through virtual functions and recursive calls. The interpreting mechanism executes codes through massive recursive calls. When executing statements such as return, break, or continue, the control flow should be returned to specific ancestor, and it can not be done by simplex recursive call. This problem is solved by adopting try/catch mechanism. The Syntax tree and interpreting mechanism proposed in the thesis provides an infrastructure for software developing and reengineering. |
第三語言摘要 | |
論文目次 |
目錄 1. 緒論 1 1.1. 研究動機 1 1.2. 相關研究 1 1.3. 研究目的 3 1.4. 論文組織 3 2. 語法樹的繼承關係 4 2.1. 程式庫oai.lex 4 2.2. 程式庫oai.tree.exp 5 2.3. 程式庫oai.tree.stmt 6 2.4. 程式庫oai.tree.def 6 3. 語法樹的內部結構 9 3.1. 程式庫單元的內容 9 3.2. 類別單元的內容 9 3.3. 欄位單元的內容 11 3.4. 方法單元的內容 12 3.5. 建構子單元的內容 14 3.6. 其他單元 16 4. 算式的計值 17 4.1. 基本運算單元 17 4.2. 運算符號的計值 20 4.3. 陣列存取式的計值 23 4.4. 方法呼叫式的計值 25 4.5. 類別樣例建立式的計值 26 4.6. 陣列建立式的計值 27 5. 敘述的執行 30 5.1. 區塊敘述及break敘述的執行 30 5.2. 區域變數宣告敘述的執行 31 5.3. 算式敘述的執行 32 5.4. 迴圈敘述與continue敘述的執行 32 5.5. if敘述與switch敘述的執行 34 5.6. throw敘述與try敘述的執行 37 5.7. return敘述、方法的執行及建構子的執行 39 5.8. synchronized敘述的執行 44 6. B級程式碼的直譯及T / B級之間的銜接 46 6.1. B級程式碼的直譯機制 46 6.2. T級類別與B級類別的銜接 51 7. 直譯實例與效能評估 53 7.1. 直譯實例 53 7.2. 效能評估 57 8. 結論與展望 59 8.1. 本論文在實務上的貢獻 59 8.2. 後續工作 60 參考文獻 61 圖目錄 圖 1.1傳統Java程式執行步驟 1 圖 2.1程式庫oai.lex類別繼承圖 4 圖 2.2程式庫oai.tree.exp類別繼承圖 5 圖 2.3程式庫oai.tree.stmt類別繼承圖 6 圖 3.1類別PkgDefUnit的內部結構 9 圖 3.2類別ClassDefUnit的內部結構 9 圖 3.3 TLevClassDefUnit的內部結構 10 圖 3.4類別TLevFieldDefUnit的欄位成員 12 圖 3.5 BLevFieldDefUnit的內部結構 12 圖 3.6 MethodDefUnit的內部結構 13 圖 3.7類別TLevMethodDefUnit的欄位成員 13 圖 3.8 BLevMethodDefUnit的內部結構 14 圖 3.9類別TLevCtorDefUnit的內部結構 15 圖 3.10 BLevCtorDefUnit的內部結構 15 圖 4.1類別OAIFrame的資料結構 19 圖 6.1 T級類別與B級類別橋接圖 51 表目錄 表 7.1效能評估 58 |
參考文獻 |
參考文獻 [1] BlueJ team, "BlueJ", http://www.bluej.org, at Deakin University, Melbourne, Australia, and the University of Kent at Canterbury, UK., April 2006. [2] Pat Niemeyer, "BeanShell", http://www.beanshell.org, 2006. [3] Stephane Hillion, "DynamicJava", http://koala.ilog.fr/djava/index.html, June 2002. [4] A.V. Aho, R. Sethi and J. D. Ullman, "Compiler Principles, Techniques, and Tools", Addison-Wesley, 1985. [5] Ken Arnold, James Gosling and David Holmes, "The Java Programming Language, Third Edition", p282-p303, Addison-Wesley, July 1997. [6] James Gosling, Bill Joy, Guy Steele and Gilad Bracha, "The Java Language Specification, Second Edition", Addison-Wesley, 2000. [7] Sun Microsystem, Inc. "Java 2 Platform, Standard Edition(J2SE) Version1.4.2" , http://java.sun.com/j2se/1.4.2/, Feb 2006. [8] Tim Lindhohn and Frank Yellin, "Java Virtual Machine Specification, second edition", Addison-Wesley, 1999. [9] Martin Fowler, "Refactoring - Improving the Design of Existing Code", Addison-Wesley, 2003. [10] 陶彥樺, "JAVA程式探索器 ", 淡江大學資訊管理所碩士論文, Jun 2001. |
論文全文使用權限 |
如有問題,歡迎洽詢!
圖書館數位資訊組 (02)2621-5656 轉 2487 或 來信