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

Preview:

Citation preview

COSC 3127Programming 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

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%

Why programming languages?

Calculate mytax bill

01010101011011010001010101010110011000101010101101010101010101010110110100010101010001100110001010101011010101011101010101101101000101010101011001100010101010110101010101010101011011010001010101001110011000101010101101010101

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

Computer

processing

Why programming languages?

Human

effort1949

2007

???

Calculate mytax bill

01010101011011010001010101010110011000101010101101010101010101010110110100010101010001100110001010101011010101011101010101101101000101010101011001100010101010110101010101010101011011010001010101001110011000101010101101010101

Computer

processing

Why programming languages?

Human

effort

1949

Computer

processing

Why programming languages?

Human

effort

2007

Language design

Question 1

Domain specific OR General purpose?

Maple

Excel

Photoshop

awk

JAVA

C,C++,C#

Pascal

libraries

Calculate mytax bill

01010101011011010001010101010110011000101010101101010101010101010110110100010101010001100110001010101011010101011101010101101101000101010101011001100010101010110101010101010101011011010001010101001110011000101010101101010101

Language design - constraints

Humans:

Creative

Intuitive

Forgetful

Prone to error

Computers:

Precise

Logical

von Neumann architecture

von Neumann Architecture(Sebesta)

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

Move data

I/O data

Operate on data (test, compute)

Reset program counter

Instruction setMemory codes

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

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

Sample slide page

• Text

• Text

• Text

Recommended