1 / 12

Lex&Yacc 的結合

Lex&Yacc 的結合. 範例 : 實作一個簡易的 compile 執行環境 & 工具 Windows XP: Flex 、 Bison 、 VC++ Fedora 4 linux: lex 、 Bison 、 cc 檔案說明 : Lex source file: lexl.l yacc file: yacca.y 自定義標頭檔 :lexa.h. YACC File. yacc declarations. Grammar rules. Grammar rules. Additional C code. LEX File. Definitions.

clodia
Download Presentation

Lex&Yacc 的結合

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lex&Yacc的結合 • 範例:實作一個簡易的compile • 執行環境&工具 • Windows XP: Flex、Bison、VC++ • Fedora 4 linux: lex 、Bison、cc • 檔案說明: • Lex source file: lexl.l • yacc file: yacca.y • 自定義標頭檔:lexa.h

  2. YACC File

  3. yacc declarations

  4. Grammar rules

  5. Grammar rules

  6. Additional C code

  7. LEX File

  8. Definitions

  9. Transition rules

  10. 執行結果 實作加法運算 輸出個是為double型態 實作除法運算 當除數為0,輸出divide by zero

  11. 參考資料 • lex & yacc, 2/E書名:lex & yacc 中譯本(修訂版)作者:John R. Levine, Tony Mason & Doug Brown

  12. ~END~

More Related