COSC 3127 Programming Languages Dave Goforth [email protected] FA377.
-
Upload
nickolas-carson -
Category
Documents
-
view
230 -
download
0
Transcript of COSC 3127 Programming Languages Dave Goforth [email protected] FA377.
![Page 2: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/2.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/3.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/4.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/5.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/6.jpg)
Computer
processing
Why programming languages?
Human
effort
1949
![Page 7: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/7.jpg)
Computer
processing
Why programming languages?
Human
effort
2007
![Page 8: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/8.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/9.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/10.jpg)
von Neumann Architecture(Sebesta)
![Page 11: COSC 3127 Programming Languages Dave Goforth dgoforth@cs.laurentian.ca FA377.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/11.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/12.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/13.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/14.jpg)
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.](https://reader035.fdocuments.net/reader035/viewer/2022062217/56649e4f5503460f94b46c9a/html5/thumbnails/15.jpg)
Sample slide page
• Text
• Text
• Text