Lesson3 IntroductionToCompilingA

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 19

Language Design

Lesson 3
ICS 40
Topic Outline:
 Evolution of Programming Languages
 Language Designs

EBY Compilers Lesson 3


Evolution of Programming
Languages
 Machine language
 The move to higher-level languages
 Impacts on compilers

EBY Compilers Lesson 3


Evolution of Programming
Languages: Machine language
 1940’s - 1st electronic computers
 Machine language – sequences of 0’s
and 1’s
 Operations -Low-level
 Move data from one location to another
 Add the contents of two registers
 Compare two values
 Slow, tedious and error prone

EBY Compilers Lesson 3


Evolution of Programming
Languages: Higher-Level
 1950’s – mnemonic assembly languages
 Mnemonic representations of machine
instructions
 Macro instructions were added
 To define shorthands for frequently used
machine instructions
 1950’s latter half
 Fortran for scientific computation
 COBOL for business data processing
 Lisp for symbolic computation

EBY Compilers Lesson 3


Compiler Design Principles

Lesson 3
Introduction to Compiling (Cont.)
Evolution: Classification by
Generation
 First-Generation Languages
 Machine languages
 Second-Generation Languages
 Assembly Languages
 Third-Generation Languages
 Fortran
 COBOL
 Lisp
 C
 C++
 C#
 Java
EBY Compilers Lesson 3
Evolution: Classification by
Generation
 Fourth-Generation Languages
 NOMAD – for report generation
 SQL – database queries
 Postscript – text formatting
 Fifth-Generation Languages
 Logic & constraint-based languages
 Prolog
 OPS5

EBY Compilers Lesson 3


Evolution: Classification as
Imperative and Declarative
 Imperative
 For languages in which a program specifies how
a computation is to be done
 C, C++, C# and Java
 Declarative
 For languages in which a program specifies
what computation is to be done.
 ML, Haskell – functional languages
 Prolog – constraint logic languages

EBY Compilers Lesson 3


Evolution: as von Neumann
Languages
 Von Neumann Languages
 Fortran
 C
 Computational model is based on the
von Neumann computer architecture

EBY Compilers Lesson 3


Evolution: Object-Oriented
Language
 Supports object-oriented
programming
 A program consist of a collection of
object that interact with one another
 Simula 67
 Smalltalk
 C++, C#
 Java
 Ruby

EBY Compilers Lesson 3


Evolution: Scripting Languages
 Interpreted languages with high-level operators
designed for “gluing together” computations
 These computations were originally called “scripts”
 Awk
 JavaScript
 Perl
 PHP
 Phthon
 Ruby and
 Tcl
 These are much shorter than equivalent program
written in languages like C

EBY Compilers Lesson 3


Language Design:

 “A good language is one people use.”

EBY Compilers Lesson 3


Language Evaluation Criteria:
Characteristics Criteria
Readability Writeability Reliability

Simplicity * * *
Data Types * * *
Syntax Design * * *
Abstraction * *
Expressivity * *
Type Checking *
Exception Handling *
EBY Compilers Lesson 3
History of Ideas: Abstraction
 Modes of abstraction
 Via languages/compilers
 Higher-level code
 Via subroutine
 Abstract interface to behavior
 Via modules
 Export interfaces: hide implementation
 Via abstract data types
 Bundle data with its operations

EBY Compilers Lesson 3


History of Ideas:Types
 Originally, few types
 FORTRAN
 LISP
 Realization: Types help
 Allow the programmer to express abstraction
 Allow the compiler to check against many
frequent errors
 Recently
 Lots on interest in types
 Experiments with various forms of
parameterization
 Best developed in functional programming

EBY Compilers Lesson 3


History of Ideas:Reuse
 Goal: mass-produced software components
 2 popular approaches
 Type parameterization (List(int), List(double))
 Classes and inheritance
 Combined in C++ and Java
 Inheritance allows
 Specialization of existing abstraction
 Expension, modification and hiding behavior

EBY Compilers Lesson 3


Trends
 Language Design
 Compilers
 More needed and more complex
 Driven by increasing gap between
 New languages
 New architecture

EBY Compilers Lesson 3


Why study Languages and
Compilers?
1. See many basic CS concepts at work
2. Learn to build a large and reliable
system
3. Increase ability to learn new
languages
4. Improve understanding of program
behavior
5. Increase capacity of expression
EBY Compilers Lesson 3

You might also like