Some important factors from "Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta"

:Chapter 11, 12

 

(p.472) Abstraction is a weapon against the complexity of programming; its purpose is to simplify the programming process.

 

process abstraction: function/subporgrams

=> problem: side effect(touches variables other than itself  --> coupling modules occur)

⬥data abstraction: object-oriented

 

⬥an abstract data type is an enclosure that includes only the data representation of one specific data type and the subprograms that provide the operations for that type.(p.473)  ==>encapsulation, abstraction hiding

 

constructor(used to initialize the data members of newly created objects.) VS destructor(implicitly called when the lifetime of an instance of the class ends.)

 

interface vs implementation


There are three key features that Object-Oriented languages must provide:

: Abstract data type(ADT), inheritance, dynamic binding(polymorphism)

 

inheritance ==> customizing(reuse with modification): 1.override 2.add new member

 

productivity increase: 1.reuse 2.automation

 

class variables: only exist in class = not created in an instance

(if used in an instance, it means it has used the variable from a class)

class method: can call from a class without an instance

Some important factors from "Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta"

:Chapter 6

 

FORTRAN: array & COBOL: record

 

primitive data types(4): integer, float, boolean, character

 

string operations: assignment, catenation, substring reference, comparison, pattern matching.

 

3 approaches to supporting the dynamic allocation and deallocation for dynamic length strings

-linked list

-store strings as arrays of pointers to individual characters allocated in the heap

-store complete strings in adjacent storage

 

2 types of structures(array, record) & tuple type/associative arrays

 

⬥purpose of pointers: indirect addressing, dynamic storage(dynamic variables in heap)

 

garbage(p.302): an allocated heap-dynamic variable that is no longer accessible to the user program

 

memory leakage: The first heap-dynamic variable is now inaccessible, or lost

 

dangling pointer: a pointer that contains the address of a heap-dynamic variable that has been deallocated.

 

eager approach(if count=0, retrieve immediately) VS lazy approach(if count=0, leave it and retreive later if short on memory)

 

Casting(explicit type conversion) VS Coercion(implicit/automatic type conversion)

 

strongly typed(make it compatible through casting=Java, C#) VS weakly typed(coersion=C)

 

name type equivalance(stronger) VS structure type equivalence

 

A data type defines a set of values and a collection of operations on those values. A type system is a set of types and the rules that govern their use in programs. Every typed programming language defines a type system.(p.317) 

 

 

Some important factors from "Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta"

:Chapter 5

 

6 attributes of variables: name, address, value, type, lifetime, and scope.

 

Aliasing(3)

-C and C++ is with their union types

-when "call by reference," ==> actual/formal parameter have the same value

-two pointer variables have the same value

 

static type binding VS dynamic type binding

(cf) disadvantage of dynamic type binding: type finding check X, high cost)

 

storage bindings and lifetime

-static variables: global(non-local) variable / “static” local variable

-stack-dynamic variable: local variable

-explicit heap-dynamic variable

 

⬥purpose of functions: reuse(with modifications), process abstraction, information hiding

 

static scope: functions are allowed nesting(eg.ALGOL60)

  However, C-based languages do not allow nested subprograms.

 

referencing environment

-nesting O: local, global, non-local

-nesting X: local, global

 

Named constants: useful aids to readability and program reliability

 

Some important factors from "Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta"

:Chapter 3, 4

 

context-free(one meaning for one lexeme) VS context-sensitive(one word having various meanings regarding the various situations)

 

BNF(Backus–Naur form)

p.139_an exampme of a BNF
p.140_A Grammar for a Small Language

The derivation of the program from above is as follows:

<program> => begin <stmt_list> end
 => begin <stmt> ; <stmt_list> end
 => begin <var> = <expression> ; <stmt_list> end
 => begin A = <expression> ; <stmt_list> end
 => begin A = <var> + <var> ; <stmt_list> end
 => begin A = B + <var> ; <stmt_list> end
 => begin A = B + C ; <stmt_list> end
 => begin A = B + ; <stmt> end
 => begin A = B + C ; <var> = <expression> end
 => begin A = B + C ; B = <expression> end
 => begin A = B + C ; B = <var> end
 => begin A = B + C ; B = C end

 

(cf) Derivations that use this order of replacement are called leftmost derivations.


⬥Hierarchical structures are called parse trees.

p.141_A Grammar for Simple Assignment Statements

From grammar of Example 3.2, through leftmost derivation, the following can be generated:

<assign> => <id> = <expr>
 => A = <expr>
 => A = <id> * <expr>
 => A = B * <expr>
 => A = B * ( <expr>)
 => A = B * ( <id> + <expr>)
 => A = B * ( A + <expr>)
 => A = B * ( A + <id>)
 => A = B * ( A + C )

 

Therefore, the following parse tree can be created:

p.142_Figure 3.1: a parse tree for A = B * (A + C)

There can be a unique parse tree or an ambiguous parse tree according to the grammar.

A unique parse tree will have an associativity of operaters(either lefts or right associativity)


lexical analysis: find a lexeme --> add a token --> transfer to syntax analyzer

 + 3 more factors(s skipping comments and white space outside lexemes, create symbol table, error-detect)

 

State transition diagram: similar to the finite automata from maths

 

Parsing: top-down(preorder/recursive-descent parser, LL) VS bottom-up(postorder, LR)

 

Syntax analysis purpose:

-check the input program to determine whether it is syntactically correct(=grammar checking)

-produce a complete parse tree(parsing)

 

Some important factors from "Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta"

:Chapter 1, 2

 

Reasons for studying concepts of programming languages

-Increased capacity to express ideas

-Improved background for choosing appropriate languages

-Increased ability to learn new languages.

 

programming domains: scientific, business, artificial intelligence, web software

cost: training programmers, writing / compiling / executing programs

 

Computer Architecture

-machine codes consists of operator & operands

-von-Neumann: fetch->decode: fetch-execute(=instruction) cycle

-load, store, jump, ALU

 

programming lagnauges are often cateogorized into four bins: imperative, functional, logic, object oriented

 

⬥Digitalizing Analgogues(2): 1.sampling 2.quantization

 

3 ways of executing programs

: compilation, pure interpretation, hybrid implementation system(using the Just-In-Time compiler)

 

intermediate code purpose

: code optimization, hardware platform independent, finding errors that have been missed while syntax analysis process

HTML: hyper text: 소리와 음성을 하나의 문서로 만든다.

(eg) 소리, 화상(그림), 냄새, 촉감, 맛 = 오감을 모두 디지털화한다

 

아날로그의 디지털화: sampling(샘플링), quantization(양자화)

(eg1)

-그림(eg.30frame/sec):  pixel에 대해서 color값을 준다 == quantization 활용

-소리: 시간따라 샘플링을 한다 (사람 음성: 초당 8000번 정도면 충분, 250level)

-동영상: 초당 30 프레임 가야 끊김이 없다 --> 압축기술의 발달 필요

 

(cf)Hypertext 주고 받는 protocol = HTTP

    복원역할 = Browser

Reasons for studying concepts of programming languages(프로그래밍 언어를 배운 이유 4가지)

1. Increased capacity to express ideas

2. Improved background for choosing appropriate languages

3. Increased ability to learn new languages

 

컴퓨터 사용하는 응용분야_그 응용분야에 적합한 분야들의 발전 (4가지)

1. Scientific Applications

2. Business Applications

3. Artificial Intelligence

3. Web Software

 

Language Evaluation Criteria

source: Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta p.31

 

Influences on language design

source: Concepts of Programming Languages (global edition) 11ed. - Robert W. Sebesta p.42

★Fetch-execution cycle(=instruction cycle)

Assignment statement(배정문)_eg.  a = b + c : load, 연산, store, jump를 통해서 이루어진다.

(cf)jump의 경우, PC 값을 바꿔서 흐름을 바꾼다.

(cf)어디서 fetch를 할 것인가 = PC가 가지고 있다.

 

Language Categories(4가지)

1. imperative

2. functional

3. logic

4. object oriented

+ Recent posts