cs 424 524 programming languages n.
Skip this Video
Download Presentation

Loading in 2 Seconds...

play fullscreen
1 / 37

CS 424/524 PROGRAMMING LANGUAGES - PowerPoint PPT Presentation

  • Uploaded on

CS 424/524 PROGRAMMING LANGUAGES. Overview. Course Organization. Class meetings: MW 3:55pm-5:15pm TH N326 Instructor Information: Dr. Mary Ellen Weisskopf Email: weisskop@cs.uah.edu Phone number: (256) 824-6306 Office: Technology Hall, N300A.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'CS 424/524 PROGRAMMING LANGUAGES' - camden-marsh

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Course Organization

Class meetings:

  • MW 3:55pm-5:15pm
  • TH N326

Instructor Information:

  • Dr. Mary Ellen Weisskopf
  • Email: weisskop@cs.uah.edu
  • Phone number: (256) 824-6306
  • Office: Technology Hall, N300A
programming languages 2nd edition tucker and noonan
Programming Languages2nd editionTucker and Noonan

Chapter 1


A good programming language is a conceptual universe for thinking about programming.

A. Perlis


1.1 Principles

1.2 Paradigms

1.3 Special Topics

1.4 A Brief History

1.5 On Language Design

1.5.1 Design Constraints

1.5.2 Outcomes and Goals

1.6 Compilers, Interpreters, and Virtual Machines

1 1 principles
1.1 Principles

Programming languages have several properties:

  • Syntax
  • Names & types
  • Semantics

For any language:

  • Its designers must define these properties
  • Its programmers must master these properties
  • The syntax of a programming language is a precise description of all its grammatically correct programs.
    • Rules that define how symbols can be combined to create legal language statements and how the statements can be combined into programs

When studying syntax, we ask questions like:

    • What is the grammar for the language? (grammar = rules)
    • What is the basic vocabulary? (operators/variables/…)
    • How are syntax errors detected?

Various kinds of entities in a program have names:

variables, functions, parameters, classes, objects, …

Named entities are bound in a running program to:

  • Scope
  • Visibility
  • Type
  • Lifetime

A type is a collection of values and a collection of operations on those values.

  • Simple types: numbers, characters, booleans, …
  • Structured types: Strings, lists, trees, hash tables, …

A language’s type system can help to:

  • Determine legal operations
  • Detect type errors

A program’s meaning is called its semantics.

In studying semantics, we ask questions like:

  • When a program is running, what happens to the values of the variables?
  • What does each statement mean?
  • What underlying model governs the run-time behavior of a function call?
  • How are objects allocated to memory at run-time?
    • Run-time stack, heap
    • Related to function behavior & implementation
1 2 paradigms
1.2 Paradigms

A programming paradigm is a pattern of problem-solving thought that underlies a particular category of programs and languages.

There are four main programming paradigms:

  • Imperative
  • Object-oriented
  • Functional
  • Logic (declarative)
imperative paradigm
Imperative Paradigm

Follows the classic von Neumann-Eckert model:

  • Program and data are indistinguishable in memory
  • Program = a sequence of commands
  • State = values of all variables when program runs

Large programs use procedural abstraction as a way to organize individual imperative statements.

Example imperative languages:

  • Cobol, Fortran, C, Ada, Perl, …
object oriented oo paradigm
Object-oriented (OO) Paradigm

An OO Program consists of a collection of objects that interact by passing messages that transform object state.

OO languages are characterized by

  • Data encapsulation/abstraction
  • Inheritance
  • Polymorphism

Example OO languages: Smalltalk, Java, C++, C#, and Python

functional paradigm
Functional Paradigm

Functional programming models a computation as a collection of mathematical functions.

  • Input = domain
  • Output = range

Functional languages are characterized by:

  • Functional composition
  • Recursion

Example functional languages:

  • Lisp, Scheme, ML, Haskell, …
logic paradigm declarative
Logic Paradigm (Declarative)

Logic programming declares what outcome the program should accomplish, rather than how it should be accomplished.


When studying logic programming we see:

  • Programs as sets of constraints on a problem
  • Programs that achieve all possible solutions
  • Programs that are “nondeterministic”

Example logic programming languages: Prolog

1 3 special topics
1.3 Special Topics
  • Event handling
    • E.g., GUIs, home security systems, monitoring systems of various kinds
  • Concurrency
    • e.g., Client-server programs, rendering (in computer graphics)
  • Correctness
    • How can we prove that a program does what it is supposed to do under all circumstances?
1 4 a brief history
1.4 A Brief History

How and when did programming languages evolve?

What communities have developed and used them?

  • Artificial Intelligence
  • Computer Science Education
  • Science and Engineering
  • Information Systems
  • Systems and Networks
  • World Wide Web
1 5 on language design
1.5 On Language Design

1.5.1 – Design Constraints

  • Computer architecture
  • Technical setting
  • Standards
  • Legacy systems
design outcomes and goals
Design Outcomes and Goals
  • Outcome: What makes a language successful?
  • Goals: What characteristics make a programming language “good” ?
what makes a successful language
What Makes A Successful Language?

Key characteristics:

  • Simplicity and readability
  • Clarity about binding
  • Reliability
  • Support
  • Abstraction
  • Orthogonality
  • Efficient implementation
simplicity writeability and readability
Simplicity (Writeability) and Readability
  • Easy to learn
    • Don’t include too many features
    • Don’t make it too complex
  • Simple conceptual model of semantics.
  • Uniformity:Similar syntax => similar semantics.
  • Lexical and syntactic conventions:
    • descriptive identifier names, blocking of compound statements
  • Readability is not synonymous with wordiness: COBOL is not easier to read.
clarity about binding
Clarity about Binding

A language element is bound to a property at the time that property is defined for it.

So a binding is the association between an object and a property of that object

  • Examples:
    • a variable and its type
    • a variable and its value
major binding times
Major Binding Times
  • Major binding times
    • Language definition time
    • Language implementation time
    • Program writing time
    • Compile time
    • Load time
    • Execution time
  • In general,
    • Early binding takes place at compile-time or before
    • Late binding takes place at load time or run time

A language is reliable if:

  • Program behavior is the same on different platforms
    • E.g., early versions of Fortran weren’t
  • Type errors are detected
    • E.g., C vs Haskell
  • Semantic errors are properly trapped
    • E.g., C vs C++ or Java
  • Memory leaks are prevented
    • E.g., C vs Java
language support
Language Support
  • Accessible (public domain) compilers/interpreters
  • Good texts and tutorials
  • Wide community of users
  • Integrated with development environments (IDEs)
abstraction in programming
Abstraction in Programming
  • Data
    • Programmer-defined types/classes
    • Class libraries
  • Procedural
    • Programmer-defined functions
    • Standard function libraries
  • Supports code reuse; simplifies the programming process.
  • A language is orthogonal if it is built on a small, mutually independent set of primitive operations.
    • You can use one feature without worrying about how it affects others
    • Rules don’t have exceptions;
    • Context doesn’t affect the behavior of a language feature (e.g., a reserved word doesn’t have different meanings based on where it’s used).
  • Non-orthogonal examples (rule exceptions):
    • In C, a function can return a struct, but not an array. Orthogonality => return value can be from any type.
    • Most imperative languages don’t allow function definitions to be passed as arguments
  • Orthogonal languages are in general easier to read and write
efficient implementation
Efficient Implementation
  • Embedded systems
    • Real-time responsiveness (e.g., navigation)
    • Failures of early Ada implementations – real time?
  • Web applications
    • Responsiveness to users (e.g., Google search)
  • Corporate database applications
    • Efficient search and updating
1 6 compilers and virtual machines
1.6 Compilers and Virtual Machines

Compiler – produces machine code

Interpreter – executes instructions directly

  • Example compiled languages:
    • Fortran, Cobol, C, C++
  • Example interpreted languages:
    • Scheme, Haskell, Python
  • Hybrid compilation/interpretation: Java
    • The Java Virtual Machine (JVM)
  • Translates source code program into object code (machine language).
  • Object code can be executed without repeating the compilation process.
  • No object code.
  • Interpretive routines
    • Examine the program. When an action is recognized, do it (by calling one of the routines).
  • Slower execution (than with compilation)
  • Better interactive development environment.
virtual machines interpreters
Virtual Machines & Interpreters
  • Some languages (e.g., Java) are compiled to machine code (byte code) that runs on a virtual machine (the JVM).
  • To run Java programs install a JVM for your machine that interprets the byte code.
  • Benefit: compiler is platform independent
  • Disdadvantage: slow
  • Solution: JIT compilers


  • Programming language principles
    • Grammars, syntax, semantics
  • What makes a language successful?
      • Reliable, readable, writeable
      • Supported by simplicity, orthogonality, efficiency, support, …
  • Paradigms
    • Imperative, object-oriented, functional, logic
  • Language implementation
    • Compilers & interpreters