0% found this document useful (0 votes)
5 views44 pages

Chapter 1

Chapter 1 provides an overview of programming languages, discussing principles of language design, including syntax, names and types, and semantics. It covers various programming paradigms such as imperative, object-oriented, functional, and logic programming, along with their historical context and applications. The chapter concludes with insights on language design constraints, goals, and the role of compilers and virtual machines in executing programs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views44 pages

Chapter 1

Chapter 1 provides an overview of programming languages, discussing principles of language design, including syntax, names and types, and semantics. It covers various programming paradigms such as imperative, object-oriented, functional, and logic programming, along with their historical context and applications. The chapter concludes with insights on language design constraints, goals, and the role of compilers and virtual machines in executing programs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 1

Overview of Programming Languages


Principles of Language Design
Language
Three Core Principles
Syntax
Syntax
The rules and structure of valid programs
(grammar, symbols, correct statements).
Names and Types
Names and Types
How entities are named (variables, functions,
classes) and categorized (integers, strings,
lists, etc.), including rules for scope, visibility,
and binding.
Semantics
Semantics
The meaning of programs—what happens
when a statement runs, how variables change,
and how the program behaves.
Programming Paradigms
Definition
Paradigms are styles or models of
programming, each suited to different
problems and ways of thinking
Imperative Programming
Based on sequences of commands (e.g., C,
Fortran).
Imperative Programming
A paradigm where you tell the computer how to
do things step by step, using statements that
change program state.

Programs are a sequence of commands that


change state
Object-Oriented Programming
Organizes code as interacting objects (e.g.,
Java, C++, Smalltalk).

Programs are a collection of interacting objects


Functional Programming
Based on mathematical functions and
immutability (e.g., Lisp, Haskell).

Programs are evaluations of mathematical


functions
Logic Programming
Describes what the outcome should be, not
how to achieve it (e.g., Prolog).

Programs are a set of logical statements and


rules
Special Topics in Language
Design
Event Handling
Programs respond to unpredictable events
(e.g., user actions).
Concurrency
Multiple processes or threads can run
simultaneously.
Correctness
Ensuring programs work as specified for all
inputs, sometimes with formal proofs.
A Brief History of Programming
Languages
Programmin
g Language
History
1950s: Higher-order Languages
The 1950s marked the beginning of the age of
"higher-order languages" (HOLs for short). A HOL
distinguishes itself from a machine or assembly
language because its programming style is
independent of any particular machine
architecture.

The first higher-order languages were Fortran,


Cobol, Algol, and Lisp. Both Fortran and Cobol
have survived and evolved greatly since their
emergence in the late 1950s.
1950s: Higher-order Languages
The following user communities can claim a major
stake in the programming language landscape:
• Artificial intelligence
• Education
• Science and engineering
• Information systems
• Systems and networks
• World Wide Web
Artificial Intelligence
Since the 1960s, the AI programming community has
focused on modeling human intelligence, logical
deduction, and cognition.
Core goals included symbol manipulation, functional
expressions, and logical proof systems.

Two paradigms emerged strongly from AI research:


• Functional programming - Languages like Lisp,
Scheme, ML, Haskell
• Logic programming - Mainly Prolog and Constraint
Logic Programming (CLP)
Education
1960s–1970s: Programming languages were created
mainly for education.
• BASIC (1960s, John Kemeny) → designed for teaching
via time-sharing systems; widely used in schools and
science programs.
• Pascal (1970s, derivative of Algol) → became the main
teaching language in college computer science
curricula.

Recent decades: These teaching languages were


replaced by industrial-strength languages like C, C++,
and Java.
Engineering
Early history (1940s): First programs were written in
machine and assembly language to calculate ballistic
trajectories during WWII.

Driving force: Scientific and engineering applications


have always demanded maximum processing power,
leading to today’s supercomputers measured in
teraflops.

Applications today: Modeling complex natural systems


(bioinformatics, earth and atmospheric sciences).
Engineering
Key Languages
• Fortran (1954, John Backus): First major scientific
language, still widely used.
• Early versions had portability issues (programs behaved
differently on different machines).
• Algol (1959): Designed to provide a well-defined language
for computation and publication of algorithms.
• Jovial (1960s, Jules Schwartz): Derived from Algol, used in
U.S. Department of Defense applications.
• APL (1960s, Kenneth Iverson): Specialized for matrix
computations, extremely concise but hard to read; required
a custom keyboard
Information Systems
Origins: Corporations in the 1950s adopted computers to reduce
record-keeping and improve accuracy.

Applications: Payroll, accounting, sales/marketing, inventory,


manufacturing — all require processing large volumes of data with
relatively simple transformations.

Languages:
• COBOL (1950s): Imperative, English-like syntax, verbose but
portable; remains widely used in business systems.
• SQL (1980s): Declarative language for relational databases, report
generation, and information retrieval; based on relational algebra.
Systems and Networks
Scope: Software that runs systems — operating systems,
compilers, debuggers, network software, virtual machines,
interpreters, and embedded systems (phones, ATMs, aircraft).

Languages:
• C (1970s): Imperative, close to machine level; 95% of Unix
written in C.
• C++ (1980s): Extension of C with object-oriented features.
• Ada (funded by U.S. DoD): Designed for command/control
and embedded systems; emphasizes correctness (with Spark
compiler).
World Wide Web
Dynamic area: Internet applications drive modern
programming in commerce, academia, government, and
industry.
Model: Web-centric computing is interactive and
event-driven — programs remain active, waiting for user
events.
Paradigms: Event-driven programming for responsiveness;
object-oriented programming to model on-screen entities
as objects.
Languages: Perl, PHP, Visual Basic, Java, Python are
common for web-centric applications.
Language Design: Constraints
and Goals
Constraints
Architecture: Must work within hardware and system
constraints.
Technical Setting: Influenced by users’ needs, platforms,
and environments.
Standards: Standardization ensures compatibility across
platforms.
Legacy Systems: Backward compatibility is important to
maintain existing code.
Constraints
Goals
Simplicity & Readability: Easy to write, read, and learn.
Clarity about Binding: Clear when properties (like types) are
set for entities.
Reliability: Consistent, predictable behavior across platforms
and runs.
Support: Accessible tools, documentation, and community.
Abstraction: Supports reusable, high-level code structures.
Orthogonality: Small, independent set of features that
combine cleanly.
Efficient Implementation: Practical and performant on
modern systems.
Compilers and Virtual Machines
Compiler
Translates source
code to machine
code for direct
execution (e.g., C,
C++).
Interpreter/ Virtual Machine
Executes programs
by simulating a
computer (e.g.,
Python, Java’s JVM).

Interpreted
languages often
offer more flexibility
and portability but
may be less
efficient.
Summary
Summary
• Studying languages helps you understand underlying principles
and broadens your problem-solving skills.
• Hands-on practice, learning new paradigms, and exploring special
topics like concurrency and correctness are key to mastering
programming languages.
Activity (Pair)
• Programming:
• Write and run a simple “Hello, World!” program in 3 contrasting languages
(Python, C, Java)
• Experience the differences in syntax, compilation, and interpretation

• Compare and Discuss


• What differences do you notice in syntax?
• Which was easier? Which required more steps?
• How did the process differ between the two languages?
• Reflect on key Chapter 1 concepts (1 Sentence): syntax, paradigms,
compilation, and interpretation
End of Chapter
References:
Tucker, A. B., & Noonan, R. (2007). Programming languages
Principles and paradigms (2nd ed.)
Scott, M. L. (2015). Programming language pragmatics (4th
ed.)
Sebesta, R. W. (2022). Concepts of programming
languages (12th ed.).

You might also like