Compiler

From OO Lab
(Difference between revisions)
Jump to: navigation, search
Line 45: Line 45:
 
===MPC instructions===
 
===MPC instructions===
  
mpc [-acdnpt] infile [outfile]
+
* mpc [-acdnpt] infile [outfile]
infile may omit a trailing .p or .pas
+
* infile may omit a trailing .p or .pas
outfile defaults to infile with .spim extension
+
* outfile defaults to infile with .spim extension
-d for debugging output
+
* -d for debugging output
-t for token file (in outfile.token)
+
* -t for token file (in outfile.token)
-p for AST after parsing (in outfile.parse)
+
* -p for AST after parsing (in outfile.parse)
-c for AST after checking (in outfile.check)
+
* -c for AST after checking (in outfile.check)
-a for AST after allocation (in outfile.alloc)
+
* -a for AST after allocation (in outfile.alloc)
-n for no code generation
+
* -n for no code generation

Revision as of 12:42, 11 July 2014

Contents

相關檔案

Compiler相關檔案皆放置於svn/lab/class_slide/compiler/

作業與期末專案

Compiler作業與期末專案皆放置於svn/lab/class_slide/compiler/non-video files

此目錄下

  • exam/ - 期末考紙本考題
  • grade/ - 成績
  • group compition/ - 小組競賽題目
  • slides/ - 上課教學投影片
  • programming projects/ - (重要) 學生作業與期末專案
    • project(lex)/ - lex 練習
    • project2(yacc)/ - yacc 練習
    • project3(yacc)/ - yacc + AST 練習
    • final_project/ - 期末專案。一個mini pascal compiler (mpc),程式會有挖空留給學生補程式碼,以及需完成編譯。
      • Final Project.docx - 題本
      • Compiler.doc - mpc 詳細參考資料,與題本一同附上
      • Mini-pascal.docx - mpc 詳細參考資料,與題本一同附上
      • FinalProject_Origin/ 原始題目
      • FinalProject_ForStudent/ 學生使用的題目 (parse.y以被挖空)
      • FinalProject_Correct_995002019/ 正確版


關於期末作業

期末作業在課程學期末前一個月發佈。

依照題本的作業說明,FinalProject_ForStudent中的parse.y已被挖空分為許多feature,須由學生填寫完成。


How to use nasm to generate executable program?

(In your project directory) (Use nasm to generate *.o file) nasm -f elf my_pascal_test.s

(Use ld to link *.o files and library and option -o for output file) ld -m elf_i386 my_pascal_test.o lib/libasm.a -o my_pascal_test


MPC instructions

  • mpc [-acdnpt] infile [outfile]
  • infile may omit a trailing .p or .pas
  • outfile defaults to infile with .spim extension
  • -d for debugging output
  • -t for token file (in outfile.token)
  • -p for AST after parsing (in outfile.parse)
  • -c for AST after checking (in outfile.check)
  • -a for AST after allocation (in outfile.alloc)
  • -n for no code generation
Personal tools