Introduction, Course Overview, and Language Specification

Download Report

Transcript Introduction, Course Overview, and Language Specification

CS 480/680 – Comparative Languages
Introduction and Overview of the
Course
What is this class about?
 By studying several programming languages,
we will learn:
• What different types of languages have in common,
and what differs

Paradigms
• How programming language features are
implemented
• How to pick up new programming languages
quickly
Introduction and Overview
2
Course Overview
1. Introduction to Programming Languages
a. Groups of Languages
b. Implementation of programming concepts
c. Formal specification of languages
2. Two Example Languages
a. Ruby – A very object-oriented language
b. Scheme – A functional programming language
3. Student Presentations of Languages
Introduction and Overview
3
Programming Language Groups




Level
Historical
Paradigm
Interpreted/Compiled/Partially-compiled
Introduction and Overview
4
Machine Code
 The lowest level “language”
 Not designed to be human readable
 An instruction consists of an opcode word,
followed by extension words
 Directly operate the gates/hardware of the CPU
0xD64A
1101 0110 0010 1010
Place the value zero into register D2.
Introduction and Overview
5
Low Level Languages
 In the beginning there was assembly language
• Requires an understanding of the CPU hardware
• Instructions directly control the registers, gates, and
devices in the CPU
MAIN
MOVE.W
ADD.W
MOVE.W
DIVS.W
BGE
#20,D3
$2002,D3
$2000,D4
D3,D4
READLOOP
One line of assembly language corresponds to one machine
code instruction.
Introduction and Overview
6
Assembly Pros and Cons
 Advantages
• Fast, efficient code
• Direct control of the hardware
 Disadvantages
• Different hardware requires a completely different
program (not just a port)

Requires knowledge of the hardware
• Many instructions to do simple operations
• Code is difficult to read and understand
Introduction and Overview
7
Compiled Languages
 Assembly is a low level language
 High level languages include C, C++, Pascal,
FORTRAN, and many others
 Source code is just ASCII text
 Compiled into executable format
• Machine code with some special tags to tell where
to load into memory
Introduction and Overview
8