15
COSC 3127 Programming Languages Dave Goforth [email protected] an.ca FA377

COSC 3127 Programming Languages Dave Goforth [email protected] FA377

Embed Size (px)

Citation preview

Page 1: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

COSC 3127Programming Languages

Dave Goforth

[email protected]

FA377

Page 2: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Topics of the course

• Understand current “state-of-the-art”

• Describe languages formally

• Understand implementation concepts

• Understand design concepts

With what purpose?

• More skillful use of languages

• Evaluation of languages

• Learning to learn languages

• New languages

Page 3: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Organization

• Lectures (notes on my website)

• Textbook (Sebesta, 8/e)

• Reference materials on Sebesta website

Evaluation

5 assignments 20%

1 project 20%

1 midterm exam 20%

1 final exam 40%

Page 4: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Why programming languages?

Calculate mytax bill

01010101011011010001010101010110011000101010101101010101010101010110110100010101010001100110001010101011010101011101010101101101000101010101011001100010101010110101010101010101011011010001010101001110011000101010101101010101

if (n<0) x := x+1;else x := 2x;n++;

Page 5: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Computer

processing

Why programming languages?

Human

effort1949

2007

???

Calculate mytax bill

01010101011011010001010101010110011000101010101101010101010101010110110100010101010001100110001010101011010101011101010101101101000101010101011001100010101010110101010101010101011011010001010101001110011000101010101101010101

Page 6: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Computer

processing

Why programming languages?

Human

effort

1949

Page 7: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Computer

processing

Why programming languages?

Human

effort

2007

Page 8: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Language design

Question 1

Domain specific OR General purpose?

Maple

Excel

Photoshop

awk

JAVA

C,C++,C#

Pascal

libraries

Page 9: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Calculate mytax bill

01010101011011010001010101010110011000101010101101010101010101010110110100010101010001100110001010101011010101011101010101101101000101010101011001100010101010110101010101010101011011010001010101001110011000101010101101010101

Language design - constraints

Humans:

Creative

Intuitive

Forgetful

Prone to error

Computers:

Precise

Logical

von Neumann architecture

Page 10: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

von Neumann Architecture(Sebesta)

Page 11: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Execution of Machine Code(Sebesta)

• Fetch-execute-cycle

(on a von Neumann architecture)

initialize the program counter

repeat forever

fetch the instruction pointed by the counter

increment the counter

decode the instruction

execute the instruction

end repeat

Page 12: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Move data

I/O data

Operate on data (test, compute)

Reset program counter

Instruction setMemory codes

Page 13: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Execution of Machine Code(Sebesta)

• Fetch-execute-cycle

(on a von Neumann architecture)

initialize the program counter

repeat forever

fetch the instruction pointed by the counter

increment the counter

decode the instruction

execute the instruction

end repeat

Instruction setMove dataOperate on dataI/O dataReset program counter

Page 14: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Memory codes

Primitive data types

arrays

records

objects

Reset program counter

if

switch

counted

recursion

branch

goto

selection repetition

logicalsubprogram

Language Evolution from machine level

Instruction set

Page 15: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377

Sample slide page

• Text

• Text

• Text