簡易檢索 / 詳目顯示

研究生: 吳鴻誠
Wu, Hung-Cheng
論文名稱: 應用於工業自動化的直譯器及直譯程式語言研究
A Study on Interpreter and Interpreted Programming Languages Applied in Industrial Automation
指導教授: 廖德祿
Liao, Teh-Lu
學位類別: 碩士
Master
系所名稱: 工學院 - 工程科學系碩士在職專班
Department of Engineering Science (on the job class)
論文出版年: 2024
畢業學年度: 112
語文別: 中文
論文頁數: 67
中文關鍵詞: 抽象語法樹CFGIEC 61131-3PLC直譯器
外文關鍵詞: Abstract Syntax Tree (AST), Context-Free Grammar (CFG), IEC 61131-3, Programmable Logic Control (PLC), Interpreter
相關次數: 點閱:57下載:25
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 本研究針對現今的工業自動化控制領域提出一款新的直譯程式語言及直譯器(Interpreter),旨在改進自動控制程式的開發過程,利用基於國際標準規範 IEC 61131-3所定義的結構化文字語言(Structured Text)來設計程式語言,透過更靈活的語法強化控制邏輯的表達方式。程式語言將採用直譯式的方式進行翻譯,開發過程可以隨時修改和測試程式碼,不需要重新編譯(Compile)整個專案,有助於簡化開發流程並提高開發效率,透過程式碼逐行執行,開發者也可以取得即時的執行結果。論文的最後,直譯器將部署到現有的自動化控制系統,並驗證程式語法的正確性,這個步驟是確保直譯器實際應用可行性的關鍵。

    This study introduces a new interpreted programming language and interpreter designed specifically for the field of industrial automation control. The goal is to enhance the development process of automation control programs by leveraging a programming language based on the structured text outlined in the international standard IEC 61131-3, this language aims to improve the expression of control logic through a more flexible syntax. The programming language will be executed by interpreted approach, allowing for on-the-fly modification and testing of code during development without the need for re-compilation of the entire project. This method simplifies the development process and enhances efficiency. Additionally, by executing the code line by line, developers can access immediate execution results. In conclusion, the interpreter will be integrated into an existing automation control systems to validate the correctness of the program. This step is crucial in ensuring the practical feasibility of applying the interpreter.

    中文摘要 i Abstract ii 致謝 vii 目錄 viii 表目錄 xi 圖目錄 xii 第一章 緒論 1 1.1 研究背景與動機 1 1.2 研究目的 2 1.3 研究方法及步驟 2 1.4 論文架構 3 第二章 文獻回顧 4 2.1 自動化控制的標準規範 4 2.1.1 IEC 61131-3 4 2.1.2 PLCOpen Motion Control Function Block 6 2.2 編譯器與直譯器的發展 7 2.2.1 Context-Free Grammar 9 2.2.2 Backus-Naur Form 9 2.2.3 Extended Backus-Naur Form 10 2.2.3.1 EBNF格式及邏輯結構 11 2.3 RS274 (G Code) Interpreter 12 2.4 Industrial Robot Interpreter 12 第三章 直譯器研究理論與實現 13 3.1 直譯器工作原理 13 3.2 抽象語法樹 16 3.2.1 遍歷方法 16 3.3 直譯程式語言設計 17 3.3.1 變數宣告 17 3.3.2 數值型態 18 3.3.3 判斷式 18 3.3.4 迴圈 19 3.3.5 WHILE 19 3.3.6 FOR 19 3.3.7 條件表達式 20 3.3.8 多重條件表達式 21 3.3.9 副程式定義 21 3.3.10 參數 22 3.3.11 副程式調用 23 3.3.12 註解 23 3.4 直譯器軟體架構設計 24 3.4.1 抽象語法樹節點定義 25 3.4.2 原始碼處理 25 3.4.3 詞法分析器 26 3.4.4 語法分析器 27 3.4.5 語意分析器 28 3.4.6 程式執行 28 3.4.7 狀態機 29 3.4.8 網路封包控制介面 31 第四章 實驗結果 32 4.1 直譯器驗證方法 32 4.2 直譯器及程式語法驗證 36 4.2.1 原始碼開啟與讀取 36 4.2.2 原始碼語法錯誤偵測 37 4.2.3 抽象語法樹產生 38 4.2.4 迴圈控制驗證 40 4.2.5 條件判斷式控制驗證 41 4.2.6 原始碼語意錯誤偵測 42 4.2.7 狀態機切換驗證 44 4.2.8 副程式調用驗證 45 4.2.9 調用外部函數庫 46 4.3 應用案例分析 47 第五章 結論與未來方向 48 5.1 結論 48 5.2 未來發展方向 49 參考文獻 50

    [1] IEC 61131-3: Programming Languages (3rd ed.), International Electrotechnical Commission, 2013.
    [2] The NIST RS274NGC Interpreter, NIST (Kramer, T. R., Proctor, F. M., and Messina, E. R.), 2000.
    [3] Function Blocks for Motion Control (Version 2.0), PLCOpen: Technical Committee 2, 2011.
    [4] Scott, M. L., Programming Language Pragmatics (3rd ed.), Morgan Kaufmann, 2009.
    [5] Kharbouch, A. A. and Karam, Z. N., “Three Models for the Description of Language,” 2006.
    [6] Sreedhar, J., Basha, H., Kumar, D. P., Jagan, A., and Kaushik, B., “NLP: Context Free Grammars and Parse Trees for Disambiguating Telugu Language Sentences.”, International Journal of Scientific Research in Computer Science, Engineering and Information Technology, Vol. 2, No. 7, pp. 332, 2017.
    [7] Mccracken, D. D., and Reilly, E. D., Encyclopedia of Computer Science, John Wiley and Sons Ltd, 2003.
    [8] Wirth, N., “What Can We Do about the Unnecessary Diversity of Notation for Syntactic Definitions?,” Association for Computing Machinery, Vol. 20, No. 11, 1977.
    [9] Information Technology - Syntactic Metalanguage - Extended BNF (Extended Backus-Naur Form) - Part 1: Syntax Notation (ISO 14977:1996), International Organization for Standardization, 1996.
    [10] Elder, R. (2020, Aug 18). “How Do Regular Expression Quantifiers Work?”, Retrieved from https://blog.robertelder.org/regular-expression-quantifiers/
    [11] Xie, M., Li, D., Cheng, M., Li, S., and Luo, Y., “Design and Implementation of an Efficient Program Interpreter for Industrial Robot.,” Journal of Physics: Conference Series, 2021.
    [12] John, L. R., Flex & Bison, Oreilly & Associates Inc. 2009.
    [13] Baeldung. (2023, May 17). “Statically Typed vs Dynamically Typed Languages.”, Retrieved from https://www.baeldung.com/cs/statically-vs-dynamically-typed-languages
    [14] GeeksforGeeks. (2021). “LR Parser.”, Retrieved from https://www.geeksforgeeks.org/lr-parser/
    [15] 鄭心皓, 訂製環境下的C語言直譯器, M.S. Thesis, 國立中興大學, 2002.
    [16] Fischer, C. N., Leblanc, R. J., and Cytron, R. K., Crafting a Compiler. Addison-Wesley. 2010.
    [17] Turba, T. N., “ACM SIGPLAN Notices - General Syntax Analyzer (GSA),” Association for Computing Machinery, Vol. 14, No. 12, 1979.
    [18] 李冠程, 使用抽象語法樹偵測有意義之程式碼更動與重複性, M.S. Thesis, 國立陽明交通大學, 2021.
    [19] Skilled, “Tree Traversal: In-Order, Pre-Order, Post-Order.”, Retrieved from https://skilled.dev/course/tree-traversal-in-order-pre-order-post-order
    [20] Spivak, R. (2015). “Let’s build a simple interpreter part 7. In Abstract syntax trees.”, Retrieved from https://ruslanspivak.com/lsbasi-part7
    [21] Merejkowsky, D. (2020). “Symlinks and .so files on Linux - what you need to know.”, Retrieved from https://dmerej.info/blog/post/symlinks-and-so-files-on-linux/
    [22] EtherCAT Technology Group. “EtherCAT - the Ethernet Fieldbus.”, Retrieved from https://www.ethercat.org/en/technology.html#4.0
    [23] Emin, E., Azir, J. and Ruhada, E., “Efficiency of calculating GCD through computer with help of modified Euclidean algorithm”, UBT International Conference, Oct. 2018

    下載圖示 校內:立即公開
    校外:立即公開
    QR CODE