Skip to content
forked from ccccourse/sp108b

系統程式 -- 108 下學期 (陳鍾誠課程的作業)

Notifications You must be signed in to change notification settings

Yongsin0/sp108b

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

系統程式課程 -- 習題專案

欄位 內容
學期 108 學年度下學期
學生 陳詠鑫
學號末兩碼 44
教師 陳鍾誠
學校科系 金門大學資訊工程系
課程首頁 系統程式

compiler-if

測試範例

a = 6;
b = 9;

if (a > b)t = a;
else t = b;

執行方法

  1. make gcc -std=c99 -O0 lexer.c compiler.c main.c -o compiler
  2. ./compiler test/cond.c
  3. 執行結果:
a = 6;
b = 9;

if (a > b)t = a;
else t = b;
========== lex ==============
token=a
token==
token=6
token=;
token=b
token==
token=9
token=;
token=if
token=(
token=a
token=>
token=b
token=)
token=t
token==
token=a
token=;
token=else
token=t
token==
token=b
token=;
========== dump ==============
0:a
1:=
2:6
3:;
4:b
5:=
6:9
7:;
8:if
9:(
10:a
11:>
12:b
13:)
14:t
15:=
16:a
17:;
18:else
19:t
20:=
21:b
============ parse =============
t0 = 6
t1 = 9
b = t1
t2 = a
t3 = b
t4 = t2 > t3
if not t4 goto L0
t5 = a
t = t5
goto L1
(L0)
t6 = b
t = t6
(L1)

About

系統程式 -- 108 下學期 (陳鍾誠課程的作業)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.5%
  • C++ 2.9%
  • Makefile 1.6%