CSC 423 – Organization of Programming Languages
Lecture 1: How to Describe
a Programming Languages
The CSC423 Team
[Alpha, 2024/25 Session]
What is Programming
Language
A programming language is an artificial formalism in
which algorithms can be expressed.
Its study can make good use of the many concepts
and tools developed in the last century in linguistics
(which studies both natural and artificial languages).
L4 2
What is Programming
Language
Morris [6] studied the various levels at which a
description of a language can occur.
Grammar
Semantics
Pragmatics.
L4 3
What is Programming
Language
Grammar is that part of the description of
the language which answers the question:
which phrases are correct?
Lexical component => word/token => Legal
phrases (syntax).
L4 4
What is Programming
Language
Semantics is that part of the description of
the language which seeks to answer the
question “what does a correct phrase
mean?”
L4 5
What is Programming
Language
Pragmatics is that part of a language
description which asks itself “how do we use
a meaningful sentence?
L4 6
What is Programming
Language
In the case of programming languages, we can add a fourth
level to the three classical ones: the implementation level.
Given that the languages that interest us are procedural
languages (that is, languages whose correct phrases specify
actions), it remains for us to describe “how to execute a
correct sentence, in such a way that we respect the
semantics”.
L4 7
What is Programming
Language
For example:
Consider the word “recipes” in cooking
Syntax determines the correct sentences with
which a recipe is expressed
The semantics is about explaining “what is” a
recipe,
L4 8
What is Programming
Language
Pragmatics studies how a cook (“that
cook”) interprets the various sentences of
the recipe
The implementation describes the way
(where, and with what ingredients) the
kitchen recipe transforms into the dish
that the semantics prescribes.
L4 9
History and Evolution of Programming
Languages
Programming languages have evolved
through several generations:
First Generation (Machine Language): The earliest form of
programming involved writing instructions in binary (0s and
1s). These are directly understood by the computer's CPU but
are extremely difficult for humans to read and write.
L4 10
History and Evolution of Programming
Languages
Second Generation (Assembly Language):
Introduced mnemonics (e.g., ADD, MOV) that made
it easier for humans to write code. Assemblers were
used to convert assembly code into machine code.
L4 11
History and Evolution of Programming
Languages
Third Generation (High-Level Languages -
1950s-1970s): Languages like FORTRAN, COBOL,
and C introduced higher-level abstractions, making
programming more accessible and reducing
hardware dependency.
L4 12
History and Evolution of Programming
Languages
• Fourth Generation (Declarative Languages -
1980s-1990s): Languages like SQL, MATLAB, and
Prolog focused on specifying what should be done
rather than how to do it.
L4 13
History and Evolution of Programming
Languages
Fifth Generation (AI and Domain-Specific
Languages - 2000s-Present): Languages like
Python, R, and Julia facilitate machine learning, data
science, and artificial intelligence.
L4 14
Why Are There So Many Programming
Languages?
Different application domains: Some languages
excel in web development (JavaScript, PHP), while
others are suited for system programming (C, Rust)
or data science (Python, R).
Security and safety: Some languages (e.g., Rust)
are designed with built-in protections against
memory-related vulnerabilities.
L4 15
Why Are There So Many Programming
Languages?
Performance optimization: Some languages
prioritize execution speed (C, C++) while others
focus on ease of use and flexibility (Python, Ruby).
Ease of learning and productivity: Modern
languages like Python emphasize simplicity, while
older languages like Assembly provide fine-grained
control over hardware.
L4 16
Why Are There So Many Programming
Languages?
• Community support and ecosystem: A strong
developer community leads to continuous
improvement, evolution, and widespread adoption of
certain languages (e.g., Java, JavaScript, Python).
• New computing paradigms: Advances in cloud
computing, IoT, and quantum computing have
driven the creation of specialized languages like
Swift, Go, and Q#.
L4 17
Why Are There So Many Programming
Languages?
• Community support and ecosystem: A strong
developer community leads to continuous
improvement, evolution, and widespread adoption of
certain languages (e.g., Java, JavaScript, Python).
• New computing paradigms: Advances in cloud
computing, IoT, and quantum computing have
driven the creation of specialized languages like
Swift, Go, and Q#.
L4 18
Application Domains
Programming languages are tailored to different
domains:
• System Programming: C, Rust, Assembly
• Web Development: JavaScript, PHP, Ruby
• Data Science & AI: Python, R, Julia
• Mobile App Development: Swift (iOS), Kotlin
(Android)
• Game Development: C++, C#, Unity
• Embedded
L4 Systems: C, Assembly 19
Language Design Considerations
When designing a language, key considerations
include:
Readability: the ease with which programs can be
read and understood
Writability: the ease with which a language can be
used to create programs
Reliability: conformance to specifications
(i.e.,performs to its specifications)
L4 20
Cost: the ultimateDesign
Language total costConsiderations
Performance and efficiency: Execution speed and
memory usage are crucial for certain applications.
Portability: The ability to run on multiple platforms
(e.g., Java’s JVM allows cross-platform execution).
Security: Languages like Rust prioritize memory
safety.
Concurrency support: Modern languages like Go
and Erlang are designed for handling multiple tasks
simultaneously
L4 21
Evaluation Criteria: Readability
• Usability, readability, maintainability, and
expressiveness
• Overall simplicity • Data types
• A manageable set of features and • Adequate predefined data types
constructs • Syntax considerations
• Minimal feature multiplicity
• Identifier forms: flexible composition
• Minimal operator overloading
• Special words and methods of forming
• Orthogonality compound statements
• A relatively small set of primitive constructs • Form and meaning: self-descriptive
can be combined in a relatively small constructs, meaningful keywords
number of ways
• Every possible combination is legal
L4 22
Evaluation Criteria: Reliability
Reliability is influenced by several factors:
Type checking
Testing for type errors Readability and writability
Exception handling A language that does not support
“natural” ways of expressing an
Intercept run-time errors and take corrective
algorithm will require the use of
measures
“unnatural” approaches, and hence
Aliasing reduced reliability
Presence of two or more distinct referencing
methods for the same memory location
L4 23
Language Design Considerations
• Portability: The ability to run on multiple platforms
(e.g., Java’s JVM allows cross-platform execution).
• Security: Languages like Rust prioritize memory
safety.
• Concurrency support: Modern languages like Go
and Erlang are designed for handling multiple tasks
simultaneously
L4 24
Influences on Language Design
1. Computer Architecture
• Most programming languages have historically been designed around the von
Neumann architecture.
• In this architecture:
• Programs and data share the same memory.
• Instructions are executed sequentially via the fetch-decode-execute cycle.
• As a result:
• Languages often feature variables, assignment statements, and loops that mirror
hardware design.
• Imperative languages like C, Pascal, and Fortran align well with this model.
L4 25
von Neumann architecture
Fetch-execute-cycle (on a von Neumann architecture computer)
initialize the program counter
repeat forever
fetch the instruction pointed by the counter
increment the counter
decode the instruction
execute the instruction
end repeat
L4 26
Influences on Language Design
2. Program Design Methodologies
• Evolving software engineering methodologies influence
how languages are designed.
• For example:
• The rise of object-oriented programming (OOP) led to
languages like C++, Java, Python, and C#.
• Functional programming gained traction with the need for
parallelism and immutability, influencing languages like
Haskell, Scala, and F#.
L4 27
Programming Methodologies Influences
🕰 1950s – Early 1960s: Machine-Oriented Focus
• Applications were simple; hardware was expensive.
• Main concern: Machine Efficiency
• Languages focused on low-level control and performance
(e.g., Assembly, early Fortran).
L4 28
Programming Methodologies Influences
🕰 Late 1960s: Human-Oriented Focus
• Programs grew larger and more complex.
• Concern shifted to Programmer Efficiency:
• Readability
• Structured control flow
• Influences:
• Structured Programming
• Top-down design
• Step-wise refinement
• Languages: ALGOL, Pascal, early C.
L4 29
Programming Methodologies Influences
🕰 Late 1970s: Shift from Process-Oriented to Data-
Oriented Design
• Emergence of data abstraction as a core concept.
• Emphasis on modular design and information hiding.
• Influences:
• Abstract Data Types (ADTs)
• Languages: Ada, Modula-2.
L4 30
Programming Methodologies Influences
🕰 Mid 1980s: Object-Oriented Programming (OOP)
• Extension of data abstraction with new features:
• Encapsulation
• Inheritance
• Polymorphism
• Promoted code reuse, modularity, and modeling of real-world
systems.
• Languages: C++, Smalltalk, later Java and Python.
L4 31
Language Categories
Programming languages can be grouped based on their computational model
and paradigm.
1. Imperative Languages
• Core Features:
• Use of variables, assignment statements, and iteration.
• Describe how a task is performed (step-by-step).
• Includes:
• Object-Oriented Languages: Java, C++, C#
• Scripting Languages: Python, JavaScript, Perl
• Visual Languages: Visual BASIC .NET
• 📌 Examples: C, Java, JavaScript, Perl, Visual BASIC .NET, C++
L4 32
Language Categories
🔹 2. Functional Languages
• Computation is based on function application.
• Focus on what to solve rather than how.
• Encourages immutability, recursion, and higher-order
functions.
• 📌 Examples: LISP, Scheme, ML, F#
L4 33
Language Categories
🔹 3. Logic Languages
• Rule-based: computation is performed by logical
inference from facts and rules.
• Rules are not ordered — declarative in nature.
• Used in AI, NLP, and knowledge-based systems.
• 📌 Example: Prolog
L4 34
Language Categories
🔹 4. Markup / Programming Hybrid Languages
• Primarily markup languages extended with
programming constructs.
• Common in web templating, data
transformation, and document processing.
• 📌 Examples: JSTL (JSP Standard Tag Library), XSLT
L4 35
Layered View of Computer
The operating
system and
language
implementation
are layered over
machine interface
of a computer
L4 36
Program Execution Models (Compilation vs.
Interpretation)
Program Execution Models (Compilation vs.
Interpretation)
There are two primary execution models for
programming languages:
• Compiled Languages:
• Examples: C, C++, Rust, Go
• A compiler translates the source code into machine code
before execution.
• Offers faster execution but requires a separate compilation
step.
L4 37
Program Execution Models (Compilation vs.
Interpretation)
• Interpreted Languages:
• Examples: Python, JavaScript, Ruby
• Code is executed line-by-line by an interpreter.
• Slower execution but allows for dynamic behavior and
easier debugging.
L4 38
Program Execution Models (Compilation vs.
Interpretation)
Compilation
Compilation is the process of translating a high-
level program (written in a source language) into
machine code (target language), which a computer
can execute directly.
• Slow Translation, but Fast Execution
• Compilation takes time upfront.
• Once compiled, the program runs efficiently.
L4 39
Phases of the Compilation Process
1. Lexical Analysis 3. Semantic Analysis
•Scans the source code. •Verifies semantic consistency:
•Converts a stream of characters into lexical
• Type checking
tokens (identifiers, keywords, symbols).
•Example: int x = 5; → tokens: int, x, =, 5, ; • Scope resolution
2. Syntax Analysis (Parsing)
• Declaration-before-use rules
•Produces intermediate representation (IR) of
• Takes the tokens from lexical analysis.
the program.
• Builds a parse tree (or abstract
4. Code Generation
syntax tree) to represent the
syntactic structure of the code.
•Converts intermediate code into machine
code or assembly.
• Checks if the code follows the
grammar rules of the language.
•Performs optimizations to enhance
performance.
L4 40
The Compilation Process
L4 41
Pure Interpretation
• A pure interpreter executes a program line-by-
line, directly from its source code, without
translating it into machine code beforehand.
L4 42
Pure Interpretation
•No Translation Step
•The program is executed directly using an interpreter.
•No intermediate machine code or compilation involved.
•Ease of Implementation
•Errors can be caught and reported immediately during execution.
•Ideal for debugging and educational environments.
•Slower Execution
•Typically 10 to 100 times slower than compiled programs.
•Every instruction must be parsed and executed repeatedly at runtime.
•Higher Memory Usage
•Interpreter and source code must be resident in memory during execution.
•Extra overhead for parsing and interpretation structures.
L4 43
Pure Interpretation
🔹 Modern Usage
• Rare for traditional compiled languages (e.g., C, C+
+).
• Comeback with Web scripting and dynamic
languages:
• 📌 Examples: JavaScript, PHP, Python (to an extent)
L4 44
Program Execution Models (Compilation vs.
Interpretation)
• Hybrid Approach:
• Example: Java (compiles to bytecode, then executed
by the JVM)
• Balances performance and portability.
L4 45
Language Standardization
Language standardization ensures consistency and
compatibility across different implementations of a
language. Organizations like ISO (International
Organization for Standardization) and IEEE
(Institute of Electrical and Electronics
Engineers) define standards for languages like C,
C++, and SQL.
L4 46
Language Standardization
Standardization benefits include:
• Ensuring compatibility across different platforms
and compilers.
• Facilitating language evolution while
maintaining backward compatibility.
• Encouraging best practices in software
development.
L4 47
Reasons for Studying Concepts of
Programming Languages
Increased ability to express ideas
Improved background for choosing appropriate
languages
Increased ability to learn new languages
Better understanding of significance of implementation
Better use of languages that are already known
Overall advancement of computing
48