Operational Semantics์ Denotational Semantics ๋ ๊ด์ ์์ statement์ command์ ๊ด๊ณ๋ฅผ ๋ช ํํ ๋น๊ตํฉ๋๋ค.
ํญ๋ชฉ | Operational Semantics | Denotational Semantics |
---|---|---|
Statement | ๋ฌธ๋ฒ ๊ตฌ์กฐ | ๋ฌธ๋ฒ ๊ตฌ์กฐ |
Command | ์คํ ๊ท์น/์ํ ์ ์ด โจstmt, ฯโฉ โ โจstmt', ฯ'โฉ ๋๋ โจstmt, ฯโฉ โ ฯ' | ์ํ๋ฅผ ๋ฐ๊พธ๋ ํจ์ โฆstmtโง : State โ State |
Statement์ Command์ ๊ด๊ณ | Statement๊ฐ ์คํ๋๋ฉฐ command๋ก ์ ์๋ ๊ท์น์ ๋ฐ๋ผ ์ํ๋ฅผ ๋ณํ์ํด | Statement์ ํด์ ๊ฒฐ๊ณผ๊ฐ ๋ฐ๋ก ์ํ๋ฅผ ๋ฐ๊พธ๋ command ํจ์๊ฐ ๋จ |
ํํ ๋ฐฉ์ | ์ถ๋ก ๊ท์น, ์ ์ด ๋ค์ด์ด๊ทธ๋จ | ์ํ์ ํจ์, ๋๋ฉ์ธ ์ด๋ก |
์ฉ์ด | ์ ์ |
---|---|
Statement | ํ๋ก๊ทธ๋๋ฐ ์ธ์ด์ ๋ฌธ๋ฒ์ ๋จ์ (e.g., x := 1 , if ... then ... , while ... ) |
Command | ๊ทธ statement๊ฐ ์๋ฏธ๋ก ์ ์ผ๋ก ์ํํ๋ ์ํ ๋ณํ (state transformation) ๋๋ ํ๋ |
์๋ฏธ๋ก ์ข ๋ฅ | Statement์ ์ญํ | Command์ ๊ฐ๋ ๋ฐ ์ญํ | ๊ด๊ณ |
---|---|---|---|
Operational Semantics | ์คํ ๊ฐ๋ฅํ ๋ฌธ๋ฒ ๊ตฌ์กฐ | ์ํ ๋ณํ๋ฅผ ์ค๋ช
ํ๋ ์คํ ๊ท์น์ ๊ฒฐ๊ณผ (state โถ state' ) |
Statement๋ ์คํ์ ์ฃผ์ฒด์ด๊ณ , Command๋ ์ฃผ์ด์ง ์ํ์์ statement๊ฐ ๋ฐ๋ผ์ผ ํ **๋์(rule)**์ ๋ปํจ |
Denotational Semantics | ํด์ ๋์์ธ ๋ฌธ๋ฒ ๊ตฌ์กฐ | ์ํ๋ฅผ ์ํ๋ก ๋ณด๋ด๋ ์ํ์ ํจ์ (State โ State ) |
Statement๋ฅผ **์ํ์ ์๋ฏธ(denotation)**๋ก ํด์ํ๋ฉด command๊ฐ ๋จ |
Statement: ๋ฌธ๋ฒ ๊ตฌ์กฐ
if b then c1 else c2
Command: transition rule๋ก ์ค๋ช ๋๋ ์ํ
โจif true then c1 else c2, ฯโฉ โ โจc1, ฯโฉ
๊ด๊ณ ์์ฝ:
Statement๋ ์ด๋ค command๋ฅผ ๋ฐ๋ฅผ์ง ์ ์ํ๋ ์ฃผ์ฒด์ด๋ฉฐ,
command๋ ๊ทธ statement๊ฐ ํ์ฌ ์ํ์์ ์ด๋ป๊ฒ ์คํ๋๋์ง๋ฅผ ๊ธฐ์ ํจ.
Statement: ๋ฌธ๋ฒ ๊ตฌ์กฐ
x := x + 1
Command: ์๋ฏธ ํจ์ โฆstmtโง : State โ State
โฆx := exprโง(ฯ) = ฯ[x โฆ โฆexprโง(ฯ)]
๊ด๊ณ ์์ฝ:
Statement๋ ์ํ์ ์๋ฏธ ๋ถ์ฌ์ ๋์์ด๊ณ ,
๊ทธ ์๋ฏธ(denotation)๊ฐ ๋ฐ๋ก command, ์ฆ ์ํ ์ ์ด ํจ์์.