• 검색 결과가 없습니다.

프로그래밍

N/A
N/A
Protected

Academic year: 2021

Share "프로그래밍"

Copied!
16
0
0

로드 중.... (전체 텍스트 보기)

전체 글

(1)

프로그래밍

• 뭔가를 해내는 방법을 기술하기

– “ 해내는” = “ 계산하는”

– 루트 2 를 찾는 방법 – 자장면을 만드는 방법 – 전화를 거는 방법

– 결혼을 하는 방법

• 뭔가를 정의하기 , 와는 다르다

– 루트 2 는 제곱하면 2 가 되는 수

– 자장면은 가장 싸고 맛있는 중국음식

– 전화걸기는 소리와 영상을 주고받고자 작업들어가는 것 – 결혼은 남자와 여자가 후손을 잘 만들어내기위한 계약

(2)

컴퓨터 프로그래밍의 어려움

• 프로그램은 규모와 복잡도가 점점 커짐

– 소프트웨어는 하드웨어가 더 좋아지는 속도보다 훨씬 빨리 더 복잡해지고 커진다

• 프로그램은 자동으로 실행됨

– 기계는 우리가 바라는 바를 실행하지 않는다

– 기계는 프로그램에 써 있는 것을 실행할 뿐이다

(3)

프로그래밍 시스템 기술의 대응

• 프로그램은 규모와 복잡도가 점점 커짐

– 프로그래밍을 점점 더 상위에서 하도록하는 도구 제공 :

• 프로그래밍 언어 시스템 : bits, assembly, C, Java, C#, Schem e, ML, etc.

– 계산의 복잡한 내용을 쉽게 관리하는 도구 제공 :

• 프로그래밍 언어 시스템 : C, Java, ML, Scheme, C#, etc.

• 프로그램이 자동으로 실행됨

– 프로그램의 오류를 자동으로 검증하는 도구 제공

• 1 세대 ( 문법검증 ): all languages

• 2 세대 ( 타입검증 ): ML, Java

• 3 세대 … : new frontiers

목표 = 그 대응의 개념 / 구조 / 방법 / 미래기술등을 실습을 통해서 익히기

(4)

이제 시작해 봅시다

(5)

프로그램을 구성하는 데 필요한 요소

• 기본원소들 primitives

– voltages, resistors, capacitors, inductors, … – 0, 1, AND gates, OR gates, NOT gates, … – integers, strings, booleans, +, -, =, ^, …

• 조합하는 방법들 means of combination

– rules about wiring together in an electronic circuit – rules about connecting together in a Boolean circuit – rules about composing together in a compound

• 속내용을 감추는 방법들 means of abstraction

– black boxes: amplifier, receiver, transmitter, … – black boxes: XOR, MUX, …

– black boxes: min, max, average, marry … pair, list, tree, set, vehicle, fire, …

• 실행과정의 이해

– electronic laws about V, I, R, C – truth tables of Bollean gates – evaluation rules of programs

(6)

Programming Elements

• 기본원소들 primitives

• 조합하는 방법들 means of combination

• 속내용을 감추는 방법들 means of abstract ion

• 프로그램 실행과정의 이해 rule of evaluatio n

(7)

Scheme Basics:

expressions, values, types

• an expression computes a value, which i s returned when the expression is evalua

ted

• every value has a type

now on in Scheme

(8)

Programming Elements: primitives

type elements built-in operators

numbers 0, -1, 10, 1

.2, 2.3e4 +, -, /, *, =, <, >, <=,

>=

strings “snow”, “thi

s is @” stringlength, string=

?

booleans #t, #f and, or, not

primitives

(9)

Programming Elements: primitives

• primitives are self-evaluating exprs

– 1 evaluates to number 1 – #t evaluates to boolean #t – “a” evaluates to string “a”

– + evaluates to number-addition operator + – / evaluates to number-division operator /

• primitives are also called “constants”

(10)

Programming Elements:

combinations

• open paranthesis, expressions, close pa ranthesis

• the expression evaluates the sub-expressions then apply the value of the 1st-subexpr to the values of argument exprs

• the 1st-subexpr must evaluate to a procedure

(+ 1 2)

compound expressions

(11)

Programming Elements:

combinations

can use nested combinations

use the combination rule recursively

(+ (* 1 2) 3)

(* (+ 1 2) (- 1 2))

(12)

Programming Elements: abstracti ons (naming)

• (define pi 3.14)

• name pi now means value 3.14

• such name-value pairs are remembered by the computer in a table called “enviro

nment”

• can use pi for 3.14 thereafter (define pi 3.14)

(* pi 10)

(13)

Programming Elements: abstracti ons (naming)

• (define <name> <expr>)

evaluates the <expr> and its return-value is named <name>.

(define pi 3.14)

(define x (+ (* pi 10) 0.1)) (= (+ x x) (* 2 x))

(14)

Scheme Basics:

rule of evaluation

• if primitives, return value

• if name, return its associated value in en vironment

• if special form, do something special

• if compound expr, then

– evaluate all the sub-expressions

– apply the operator value to the values of th e operands and return the result

(15)

Read-Eval-Print

Read

Compile; Evaluate

Print

execution world visible world

visible world

(* 2 (+ 3 4))

internal representation of expr

value of expr

14

(16)

The Two Worlds

visible world

syntax

execution world

semantics

expr

printed representation of value

value 12 value 3.14

12 12

expr

pi 3.14

eval self-rule pr in t eval name-rule pr in t

참조

관련 문서

Modern Physics for Scientists and Engineers International Edition,

한편 이 연구의 궁극적인 목적인 서비스 가격의 적절성을 평가하기 위해 질병 의 중증도를 통제한 상태에서 소득수준에 따른 외래이용을 분석하기 위하여

If both these adjustments are considered, the resulting approach is called a bootstrap-BC a -method (bias- corrected-accelerated). A description of this approach

Five days later, on 15 January 1975, the Portuguese government signed an agreement with the MPLA, FNLA and UNITA providing for Angola to receive its independence on 11

Usefulness of co-treatment with immunomodulators in patients with inflammatory bowel disease treated with scheduled infliximab maintenance therapy.. Oussalah A, Chevaux JB, Fay

Inclusion and Inclusiveness: Shared Vision of Youth for Local, National, and Global Village Inclusion at large stands for embracing populations with disabilities and

웹 표준을 지원하는 플랫폼에서 큰 수정없이 실행 가능함 패키징을 통해 다양한 기기를 위한 앱을 작성할 수 있음 네이티브 앱과

_____ culture appears to be attractive (도시의) to the