簡易檢索 / 詳目顯示

研究生: 張家瑋
Chang, Chia-Wei
論文名稱: 具Macro及GM-Code 編譯功能之CNC控制器混合編直譯器研究
A study on hybrid compiler and interpreter for CNC controller with Macro and GM-Code functions
指導教授: 陳響亮
Chen, Shang-Liang
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 製造工程研究所
Institute of Manufacturing Engineering
論文出版年: 2008
畢業學年度: 96
語文別: 中文
論文頁數: 67
中文關鍵詞: 編譯器直譯器中間碼GM CodeCNC工具機
外文關鍵詞: CNC machine tool, GM Code, Compiler, Interpreter, OP-Code
相關次數: 點閱:163下載:9
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 本研究針對目前發展CNC工具機編譯系統之迫切需求,提出一套設計架構。也就是用編譯器產生編譯器(compiler-compiler)的方法來建立CNC工具機的編譯器。

    另外、本論文提出一個GMacro語言,包含了國際標準的GM-Code與本論文定義的Macro語言。並利用GMacro語言產生中間碼(OP-Code),可以增加編譯系統支援其他工具機台的運動控制命令。

    接著設計一個Stack Computer的直譯器,直譯器功能是讀取中間碼,根據中間碼設定的動作產生命令。

    最後,本論文的實驗使用MATLAB模擬路徑與使用工具機切削工件,實機切削以證明編譯系統的正確性。藉由此核心技術的開發,本研究提供了目前產業界最需要編譯器技術,可對CNC工具機產業有極大貢獻。

    Developing a CNC compiler system is a very essential issue for developing a machine tool with good performance. The compiler-compiler concept is used in this study to develop a CNC compiler system for machine tool. Both of the international standard GM-code language and user defined Macro language can be compiled by the developed compiler system.
    The above two kinds of languages are called GMacro language in this study. The using of OP-Code which generated from GMacro language can improve the usability of GMacro language for supporting different motion control command.
    To read the generated OP-Cod, an interpreter using Stack Computer concept is first addressed in this research.
    Several experiments are performed using the developed compiler system to verify the correctness of GMarco language compiling. Both of the simulation method and practical machining test are used to evaluate the correctness of the developed compiler system. The study provides the essential concepts and procedures for developing a CNC machine tool compiling system.

    摘要 III ABSTRACT IV 誌謝 V 目錄 VI 圖目錄 VIII 表目錄 X 第一章 緒論 1 1.1 研究背景與動機 1 1.2 研究目的 1 1.3 文獻回顧 2 1.3.1 編譯器產生器發展歷程 2 1.3.2 Lex語彙分析 2 1.3.3 Yacc文法分析 4 1.3.4 Code Generator 6 1.3.5 直譯器設計方法 8 1.3.6 CNC 編譯器發展回顧 9 1.4 章節瀏覽 10 第二章 GMACRO編直譯器系統研究理論與方法 11 2.1 GMACRO 編譯器和直譯器設計流程 11 2.2 FANUC MACRO文法分析 13 2.3 直譯器設計架構與分析 14 2.4 分析直譯器執行時期狀態 16 2.4.1 Compiling Macro狀態 17 2.4.2 巨集執行狀態 18 2.4.3 立即執行狀態 18 第三章 GMACRO 編譯器軟體架構實現 19 3.1 GMACRO 正規表示式 19 3.2 GMACRO EBNF 文法 19 3.3 CODE GENERATOR 建構 23 3.4 COMPILING 錯誤顯示 28 第四章 直譯器設計以STACK COMPUTER實現 29 4.1 編譯器與直譯器系統關係與資料流 29 4.2 STACK COMPUTER直譯器變數設計 30 4.3 GMACRO程式在STACK COMPUTER直譯器執行過程 30 4.4 中間碼指令轉譯成目的碼設計 33 4.4.1 G65巨集呼叫與G68巨集返回指令設計 33 4.4.2 G00 G01 直線指令轉譯設計 37 4.4.3 G02 G03 圓弧指令轉換設計 38 4.4.4 G20 G21 公制英制轉換 38 4.4.5 G28 G29原點復歸參考點 39 4.4.6 G54 G55 G56 G57 G58 G59 工件座標 39 4.4.7 G90 G91 位置指令轉譯設計 40 4.4.8 G92程式零點座標 41 4.4.9 M-Code設計 42 4.5 中間碼正確性驗證 43 第五章 實驗結果 44 5.1 巨集內數值運算驗證 44 5.2 巨集內條件控制流程驗證 45 5.3 巨集內迴圈控制流程驗證 47 5.4 G65巨集呼叫與G68巨集返回指令驗證 49 5.5 G00 驗證 50 5.6 G02 G03 驗證 54 5.7 工件座標驗證 56 5.8 G92程式零點驗證 57 5.9 G28 G29 驗證 58 5.10 G20 G21 驗證 59 5.11 文法除錯 61 5.12 M CODE驗證 62 5.13 實際切削驗證 63 第六章 結論與建議 64 6.1 結論 64 6.2 建議 65 參考文獻 66

    [1]. Aho, A. V. and J. D. Ullman ,Principles of Compiler Design, Addison-Wesley, 1977.

    [2]. Archer T. Inside C#, Microsoft Press , 2002.

    [3]. Crowe, M. , Compiler tools in C#.
    http://cis.paisley.ac.uk/crow-ci0/, 2007.

    [4]. Earley, J. An efficient context-free parsing algorithm. ACM Press 13(2): 94 – 102 , 1970.

    [5]. Johnson, S. C. Yacc: Yet Another Compiler-Compiler. Computing Science Technical Report, 1975.

    [6]. Levine, J. Mason, T., Brown D. lex and yacc, O'Reilly & Associates,1992.

    [7]. Kleene S C.Representation of Events in Nerve Nets and Finite Automata.In Automata Studies, Princeton Univ.Press, Princeton, NJ, pp.3-41, 1956

    [8]. Lesk, M. E. LEX - a lexical analyzer generator. Computing Science Technical Report 39, 1975.

    [9]. Backus. J. W. Revised report on the algorithm language ALGOL 60. Communications of the ACM 6(11): 1-17. 1963.

    [10].Philip J. Koopman, Jr. Stack Computers: the new wave. Ellis Horwood, 1989.

    [11].Terry, P. D. Compiling with C# and Java. Harlow, England : Pearson/Addison-Wesley, 2005.

    [12].Wang Zhi-sen, Zhao Fu.-min, Zhang Yong. WU Yan-ming. Compiling of NC program. Journal of HEFEI University of Technology, Vol. 23 No 1. pp. 96-98 , 2000.

    [13]. Zhang Cheng-rui, Shan Cheng, Wang Heng. Design and realization of G Code interpreter for CNC system. Journal of SHANDONG University ,Vol. 32 No6. pp. 565-528 ,2002.

    [14].Cheng Dong, Zhang Cheng-rui, LI Jian-feng. Development of Motion Controller Controlling Language and Compiling System. Precise Manufacturing & Automation, No167. pp. 45-48 2006.

    [15].林煙桂,系統程式-使用Turbo C, 松崗,1993年

    下載圖示 校內:2013-08-25公開
    校外:2013-08-25公開
    QR CODE