snu 4190.310 programming language prof. kwangkeun yi ropas.snu.ac.kr/~kwang 컴퓨터공학부...

Post on 13-Dec-2015

259 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SNU 4190.310 Programming Language

Prof. Kwangkeun Yiropas.snu.ac.kr/~kwang

컴퓨터공학부 프로그램밍 연구실ropas.snu.ac.kr

겉모양

속내용

We use it this way

It means …

* abstract syntax* semantic formalisms

Question

How do infintely many programs exist?

For all natural number n

Can you prove it?

InductiveDefinition

귀납적인정의

“ 나는 귀납한다고로 전산학을 한다 .”

is natural number

is nat then is also natif

is nat

is nat

is nat

Natural number is a set of elements that can be checked by method I

Natural number is a set of elements that can be made by method II

/

//

///

////

syntax semantics

syntax semantics

syntax semantics

Integer expression

Programming language is the same

syntax semantics

Abstract Syntax

• 문장을 만드는 방법• 프로램을 만드는

방법

• abstract syntax is the tool for the speaker

• “concrete syntax” is the tool for the listener왜 , 무엇때문에 ,

abstract syntax 라고 하는 것인가 ?

concrete

abstract

Abstract Syntax

- specifies how to construct sentences (programs)

- no more no less- hence “abstract”

E -> Z | E + E | E * E

1 2

+

*

3

“1 더하기 2 하고 , 결과에 3 곱하기”

Concrete Syntax

• tells how to see sentences

• tells how to re-construct the

abstract syntax tree from the strings!

“1+2*3”1 차원의 실

이 실에서 부터 말한 사람이머리속에 구성했던 문장의 구조를어떻게 재구성하나 ?

Concrete Syntax tells youhow.

E -> Z | E+T | T+ET -> Z | T*T

소리 , 글

그 구조Parsing

Syntax for finding out the syntax structure in a 1-line program

1-line program should be able to be determined without confusing

Just represent core structure.

Integer expression

Once the syntax of a program is determined,Semantics should be determined without confusing

inductivesemanticdefinition

again,and always,

inductivesemanticdefinition

top related