Compiler 2007 助教網頁




   作業1:
        1. 繳交時檔名應為"學號_ex1.XXX"
          其中可被接受的格式有:(1)txt (2)htm (3)pdf (4)ps
          第二題要交一個lex的程式,請以壓縮檔繳交,檔名應為"學號_prog1.tar.gz"

        2. 請同學利用作業上傳系統來繳交作業:         
          第一次進入須先註冊,之後可以「上傳檔案」並在作業批改完後選「查看分數」看成績及註解

        3. 程式作業須有makefile,並含有3種功能(clean, all, test),並可提供個人的測試資料

        4. 程式作業之lex檔,檔名應為hwk1.l,執行檔檔名應為hwk1

        5. 程式作業必須在系上的工作站「bsd1」上compile成功,否則不予計分

        6. 附加說明:關於輸入輸出與測試資料

           a. 輸入由stdin輸入,請不要使用到檔案
           b. 輸出請由螢幕輸出(即stdout, 請不要用stderr)
           c. 批改時會使用十個測試資料,其中三個會在deadline前提供給同學測試用

        7. 作業問題說明:

           a. 3.3.5(c)quote中不可包含quote
           b. 3.3.12請寫出演算法,將SQL pattern轉換為regular expression
           c. 3.5.4同學可以假設測試資料只會有letter和whitespace,其中whitespace是空白、換行、及Tab字元

        8. 測試資料

   為了統一,同學帳號已更改,請試試是否還能正常運作

   作業2:
        1. 繳交時檔名應為"學號_ex2.XXX"
          其中可被接受的格式有:(1)txt (2)htm (3)pdf (4)ps

   
應同學要求,開了討論區供同學討論之用,請大家遵守規則使用

   作業1及作業2已批改完成,請同學去查成績,如對成績有任何疑問,請在禮拜四前用email跟我約談

   計分方式:作業1:手寫50%,程式50%(共5項測資),共100分;作業2:共100分

   作業1,2解答

   hwk4:

   testcases:(1) fibonacci.p
        (2) expression.p
        (3) errora.p
        (4) errorb.p
        (5) errorc.p
        (6) errord.p
        (7) errore.p
        (8) specialname.p
        (9) errorcagain.p
        (10) last.p     Updated!! 05/24 02:06

   specification Updated!! 05/22 22:23

   gradebot Updated!! 05/24 15:41

      usage: (under bsd)
      mkdir a new directory, "testing"
      cp gradebot.sh testing/
      cp b93902xxx.tgz testing/
      cd testing
      ./gradebot.sh b93902xxx.tgz
      outcome1
      outcome2

   tutorial for lex and yacc Updated!! 05/25 01:48

   hand in hwk4

   最後作業會在bsd5和linux3兩台主機上測試,取高分的成績登記;如果你的作業無法在這兩台機器執行,請讓助教知道

   background testcase0: bt0.p bin0 bsol0
   background testcase1: bt1.p bin1 bsol1
   background testcase2: bt2.p bin2 bsol2
   background testcase3: bt3.p bin3 bsol3
   background testcase4: bt4.p bin4 bsol4
   background testcase5: bt5.p bin5 bsol5
   background testcase6: bt6.p bin6 bsol6
   background testcase7: bt7.p bin7 bsol7
   background testcase8: bt8.p bin8 bsol8
   background testcase9: bt9.p bin9 bsol9

   note01: It's not necessary to enumerate all errors which belong to illegal
       syntax. The testcases of backgroud testing won't have the error.

   note02: If you can't pass the last sample, please check the following link.
       Recursion

   FAQ
     Q1 ans

   tiny examples:

     (1) C
     (2) C++



   hwk5

   specification Updated! 06/04 03:14

   note01: If the names of two procedures are identical,
       then the latter is dup-declared procedure.

       If the prototype of a procedure call can't be found
       in the included files, the procedure call is undeclared.

   c-- and lib.o

   bsd5:  cp ~comp07/htdocs/hwk5/bsd5/* ./
   linxu3: cp ~comp07/htdocs/hwk5/linux3/* ./
   c-- source code
   請將c--.tgz下載到全新的資料夾再解壓縮, 避免code被覆蓋
   lib.o source code

   ./pascal- -S test1.s -o test1 test1.p

   1st step of pascal-: generate intermediate code, test1.s
   2nd step of pascal-: generate the executable p.out by "./c-- test1.s"
   3rd step of pascal-: alias the name of the executable by "mv p.out test1"

   testcase1: test1.p sysio.h
         test1.s in1 sol1
   testcase2: test2.p in2 sol2
   testcase3: test3.p in3 sol3
   testcase4: test4.p in4 sol4
   testcase5: test5.p oisys.h err5 test5 :=a; %%invalid id+undeclared variable
   testcase6: test6.p err6
   testcase7: test7.p in7 sol7
   testcase8: test8.p in8 sol8
   testcase9: test9.p in9 sol9 Fix an error!! 06/13 00:35
   testcase0: test0.p in0 sol0 Updated!! 06/12 16:22

   gradebot.sh
   usage: mkdir a new directory, test
       cp b93902xxx.tbz test/
       cp gradebot.sh test/
       cd test/
       ./gradebot.sh b93902xxx.tbz

   hand in hwk5

   1. 若你的作業不能夠自動批閱 或是 2. 因為按照老師所說的方式implement而造成答案和公佈的解答不一樣;
   一樣請先交作業上來(否則算遲交), 等下周來找助教demo(用交上來的作業demo)

   demo:
      學號 % 4 < 2 請盡量在 6/20(三) 16:00~18:00 到系館217demo
      學號 % 4 > 1 請盡量在 6/22(五) 16:00~18:00 到系館217demo


   The execution order of your compiler should be:

   > ./pascal- test1.p -o test1 -S test1.s -o option, -S option, and filename can be arbitrarily arranged.
                       Use system("./c-- ...") in your pascal- to compile the intermediate code.
   > ./test1 < in1 > out1 the correct out1 should be same as sol1

   reference for included file Updated! 06/04 03:17


   另外五分直接送分
   background testcase0: bt0.p bin0 bsol0
   background testcase1: bt1.p bin1 bsol1
   background testcase2: bt2.p bin2 bsol2
   background testcase3: bt3.p bin3 bsol3
   background testcase4: bt4.p bin4 bsol4




   Final Project:

   correctness: There will be 15 testcases(3 points for each) declared in this web page later.
          Every testcase is legal and really complicated. Once you can pass at least one
          declared testcase, you'll get the remaining 5 points. (total: 3*15 + 5 = 50 points)

   sysio.h: sysio.h

   case00: bigprogram.p
       in sol
   case01: procedure.p
       in sol
   case02: function.p
       in sol
   case03: recursion.p
       in sol
   case04: nestedblocks.p
       in sol
   case05: determinant.p
       in sol
   case06: gcd.p
       in sol
   case07: honaitower.p
       in sol
   case08: warshall.p
       in sol
   case09: xor.p
       in sol
   case10: float.p
       in sol
   case11: switch.p
       in sol
   case12: circles.p
       in sol
   case13: sudoku.p
       in sol
   case14: sort.p
       in sol

   c2--: c2--source 解開來(會產生directory, c2--)再打make build就能得到c2--執行檔
   c2--和c--的差異: 1. support #define ID (id|constant)
            2. support comment in a single line // ......
            3. fix lr-shift bug
            4. support void functions
            5. support IO statment in C-- spec

   lib.o 在 ~comp07/htdocs/hwk6/bsd5/lib.o 或 ~comp07/htdocs/hwk6/linux3/lib.o
   這版新增readf writef function


   gradebot.sh usage: ./gradebot b93902xxxCode.tbz

   hand in 2 files for this project:
   1. b93902xxxCode.tbz 2. b93902xxxReport.tbz

   hand in final project

   error-handling: Make your own plan to handle errors this time and write the adopted rules in your
           documents. Showing some code fragments to describe the functionality may help us to
           understand.

   Note: Please write your documents properly to let professor Hsu know what you have done.


學期成績已公布!!請在7/4內確認是否有登記錯誤,7/5即交送成績



           助教 陳柏年 email:comp07@csie.ntu.edu.tw
           office hour: 星期五上午10:00∼12:00 332實驗室