Compiler

From OO Lab
(Difference between revisions)
Jump to: navigation, search
 
(10 intermediate revisions by one user not shown)
Line 1: Line 1:
=相關檔案=
+
= 轉移通知 =
 +
本頁面已經停止維護,請轉移到 [http://git.oolab.fntsr.tw/lab/Services/blob/master/Compiler.md GitLab 上的說明頁 ] 閱讀。
  
Compiler相關檔案皆放置於[http://oolab.csie.ncu.edu.tw/svn/lab/class_slide/compiler/ svn/lab/class_slide/compiler/]
 
  
==作業與期末專案==
+
==相關檔案==
 +
Compiler相關檔案全部皆放置於oolab的SVN Server:[http://oolab.csie.ncu.edu.tw/svn/lab/class_slide/compiler/ svn/lab/class_slide/compiler/]
 +
 
 +
==作業與期末專案說明==
  
 
Compiler作業與期末專案皆放置於[http://oolab.csie.ncu.edu.tw/svn/lab/class_slide/compiler/non-video%20files/ svn/lab/class_slide/compiler/non-video files]
 
Compiler作業與期末專案皆放置於[http://oolab.csie.ncu.edu.tw/svn/lab/class_slide/compiler/non-video%20files/ svn/lab/class_slide/compiler/non-video files]
Line 31: Line 34:
  
 
依照題本的作業說明,FinalProject_ForStudent中的parse.y已被挖空分為許多feature,須由學生填寫完成。
 
依照題本的作業說明,FinalProject_ForStudent中的parse.y已被挖空分為許多feature,須由學生填寫完成。
 +
 +
===How to use nasm to generate executable program?===
 +
 +
In your project directory. Use nasm to generate *.o file
 +
<pre>nasm -f elf my_pascal_test.s</pre>
 +
 +
Use ld to link *.o files and library and option -o for output file
 +
<pre>ld -m elf_i386 my_pascal_test.o lib/libasm.a -o my_pascal_test</pre>
 +
 +
===MPC instructions===
 +
 +
<pre>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</pre>

Latest revision as of 17:02, 4 February 2016

Contents

[edit] 轉移通知

本頁面已經停止維護,請轉移到 GitLab 上的說明頁 閱讀。


[edit] 相關檔案

Compiler相關檔案全部皆放置於oolab的SVN Server:svn/lab/class_slide/compiler/

[edit] 作業與期末專案說明

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/ 正確版


[edit] 關於期末作業

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

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

[edit] 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

[edit] 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