ccccourse / sp110b

課程:系統程式 -- 筆記、習題與報告
1 stars 50 forks source link

習題 2 : 請為 c6 編譯器加上 do ... while 語法的程式碼 #10

Open ccckmit opened 2 years ago

ccckmit commented 2 years ago

參考: https://github.com/ccc-c/c6/wiki/

補充:

  1. 若覺得 do ... while 語法太沒挑戰性,可以改加 for 迴圈語法 (分數會更高)。
  2. 你先 fork c6 專案,然後才去改寫。
z22756392z commented 2 years ago

https://github.com/z22756392z/c6

stereomp3 commented 2 years ago
// 需要在前面enum加上 Do,後面的compiler 的 p加上 do
else if (tk == Do){  
    next();
    a = e + 1;
    stmt();
    if (tk == While) next(); else { printf("%d: open while expected\n", line); exit(-1); }
    if (tk == '(') next(); else { printf("%d: open paren expected\n", line); exit(-1); }
    expr(Assign);
    if (tk == ')') next(); else { printf("%d: close paren expected\n", line); exit(-1); }
    if (tk == ';') next(); else { printf("%d: close ; expected\n", line); exit(-1); }
    *++e = BNZ; *++e = (int)a; // BNZ是代表不是 0 的時候跳,這裡是跳入迴圈
  }
yucing commented 2 years ago

110910511 蘇郁晴 https://github.com/yucing/sp110b/wiki/e2.md

Mocha777 commented 2 years ago

110910513林孫全 https://github.com/Mocha777/sp110b/wiki/%E7%BF%92%E9%A1%8C%E4%BA%8C

shaoan901226 commented 2 years ago

110910518 黃紹安 https://github.com/shaoan901226/sp/wiki/HOMEWORK2

nakirifumiya commented 2 years ago

110910501 王澤瑋 https://github.com/nakirifumiya/sp110b/wiki/hw2

jifkavnb0205 commented 2 years ago

110810507 李安博

Lin610313 commented 2 years ago

110910506林庭光 https://github.com/Lin610313/sp110b/wiki/work2.md

RyanChen-01 commented 2 years ago

110910515 陳文吉 https://github.com/RyanChen-01/sp110b/wiki/hw2.md

stayjay commented 2 years ago

110910507王證傑 https://github.com/stayjay/sp110b/wiki/homework2

qweasd049564 commented 2 years ago

資工三 110810509 蘇乾羽 https://github.com/qweasd049564/sp110b/blob/master/hw/hw2.md

Paouser commented 2 years ago

110910522 劉煒辰

Sakura01210 commented 2 years ago

110910508 王冠文

404HK416 commented 2 years ago

110810403 蘇彥華

zraiz commented 2 years ago

資工二 110911542 邵南翔 https://github.com/zraiz/sp110b/blob/master/Homework/02/Homeowrk02.md

yumao57 commented 2 years ago

資工二 110910529 劉宸羽 https://github.com/yumao57/sp110b/wiki/%E7%BF%92%E9%A1%8C%E4%BA%8C

choco427 commented 2 years ago

資工二110910524張詠翔

Roy-Roo commented 2 years ago

資工二 110910519 羅彥翔

kaifeng273 commented 2 years ago

資工二 110910528 吳俊億

patrick901218 commented 2 years ago

資工二 110910548 張昀翰

Kenttsai1 commented 2 years ago

110910509 蔡宗霖

jiajianong commented 2 years ago

資工二 110910535 呂嘉融

zhengyucen commented 2 years ago

資工三 110810548 鄭宇岑

WForU commented 2 years ago

資工二 110911543 何文旺 https://github.com/WForU/sp110b/wiki/HW2.md

wukunru commented 2 years ago

資工二110910510吳昆儒 https://github.com/wukunru/sp110b/wiki/%E7%BF%92%E9%A1%8C%E4%BA%8C

Uriel58 commented 2 years ago

https://github.com/Uriel58/sp110b/wiki/%E7%82%BA-c6-%E7%B7%A8%E8%AD%AF%E5%99%A8%E5%8A%A0%E4%B8%8A-do-...-while 資工二 110910503 林成也

gakuplusq commented 2 years ago

資工二 110910530 黃劭騏

Selesfia commented 2 years ago

資工二 110910552 胡禎恩

qwezxca123 commented 2 years ago

資工二 110910533 曾旭宏

mozi5269 commented 2 years ago

資工二 110910532 王昱凱

derek120432 commented 2 years ago

資工二110910514李韋德

ceen123 commented 2 years ago

資工二吳鑛山110910237

QuiLinxinag commented 2 years ago

資工二 110910536 邱麟翔

Soober9260 commented 2 years ago

資工二 110910546 施威帆

Vialbum commented 2 years ago

資工二 110910547 林鈺翔

po-hsiang666 commented 2 years ago

資工二 110910544 張博翔

OohelloworldoO commented 2 years ago

資工二 110910539 鄭智陽 https://github.com/OohelloworldoO/sp110b/wiki/exercise-2

al2698 commented 2 years ago

資工二 110910531 姜呈諭

ChiaYunn commented 2 years ago

110810535

daniel74859641 commented 2 years ago

110910563陳威宇 https://github.com/daniel74859641/-/wiki

nnnnnnn1266 commented 2 years ago

資工二 110910559潘其恩

wei-annn commented 2 years ago

110910504趙唯安 https://github.com/wei-annn/sp110b/wiki/hw2.md