Top-Rated Free Essay
Preview

Programming Language Slides(R.W. Sebesta)

Good Essays
1552 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Programming Language Slides(R.W. Sebesta)
Chapter 1

Preliminaries

ISBN 0-321-33025-0

Chapter 1 Topics
• Reasons for Studying Concepts of
Programming Languages
• Programming Domains
• Language Evaluation Criteria
• Influences on Language Design
• Language Categories
• Language Design Trade-Offs
• Implementation Methods
• Programming Environments
Copyright © 2006 Addison-Wesley. All rights reserved.

1-2

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 • Overall advancement of computing

Copyright © 2006 Addison-Wesley. All rights reserved.

1-3

Programming Domains
• Scientific applications
– Large number of floating point computations
– Fortran

• Business applications
– Produce reports, use decimal numbers and characters
– COBOL

• Artificial intelligence
– Symbols rather than numbers manipulated
– LISP

• Systems programming
– Need efficiency because of continuous use
– C

• Web Software
– Eclectic collection of languages: markup (e.g., XHTML), scripting (e.g., PHP), general-purpose (e.g., Java)

Copyright © 2006 Addison-Wesley. All rights reserved.

1-4

Language Evaluation Criteria
• Readability the ease with which
Readability:
programs can be read and understood
• Writability the ease with which a
Writability:
language can be used to create programs
• Reliability conformance to specifications
Reliability:
(i.e., performs to its specifications)
• Cost the ultimate total cost
Cost:

Copyright © 2006 Addison-Wesley. All rights reserved.

1-5

Evaluation Criteria: Readability
• Overall simplicity




A manageable set of features and constructs
Few feature multiplicity (means of doing the same operation)
Minimal operator overloading

• Orthogonality


A relatively small set of primitive constructs can be combined in a relatively small number of ways
– Every possible combination is legal

• Control statements


The presence of well-known control structures (e.g., while statement) • Data types and structures


The presence of adequate facilities for defining data structures

• Syntax considerations
– Identifier forms: flexible composition
– Special words and methods of forming compound statements
– Form and meaning: self-descriptive constructs, meaningful keywords Copyright © 2006 Addison-Wesley. All rights reserved.

1-6

Evaluation Criteria: Writability
• Simplicity and orthogonality
– Few constructs, a small number of primitives, a small set of rules for combining them

• Support for abstraction
– The ability to define and use complex structures or operations in ways that allow details to be ignored

• Expressivity
– A set of relatively convenient ways of specifying operations
– Example: the inclusion of for statement in many modern languages
Copyright © 2006 Addison-Wesley. All rights reserved.

1-7

Evaluation Criteria: Reliability
• Type checking
– Testing for type errors

• Exception handling
– Intercept run-time errors and take corrective measures

• Aliasing
– Presence of two or more distinct referencing methods for the same memory location

• Readability and writability
– A language that does not support “natural” ways of expressing an algorithm will necessarily use “unnatural” approaches, and hence reduced reliability

Copyright © 2006 Addison-Wesley. All rights reserved.

1-8

Evaluation Criteria: Cost
• Training programmers to use language
• Writing programs (closeness to particular applications) • Compiling programs
• Executing programs
• Language implementation system: availability of free compilers
• Reliability: poor reliability leads to high costs • Maintaining programs
Copyright © 2006 Addison-Wesley. All rights reserved.

1-9

Evaluation Criteria: Others
• Portability
– The ease with which programs can be moved from one implementation to another

• Generality
– The applicability to a wide range of applications

• Well-definedness
– The completeness and precision of the language’s official definition

Copyright © 2006 Addison-Wesley. All rights reserved.

1-10

Influences on Language Design
• Computer Architecture
– Languages are developed around the prevalent computer architecture, known as the von
Neumann architecture

• Programming Methodologies
– New software development methodologies (e.g., object-oriented software development) led to new programming paradigms and by extension, new programming languages

Copyright © 2006 Addison-Wesley. All rights reserved.

1-11

Computer Architecture Influence
• Well-known computer architecture: Von Neumann
• Imperative languages, most dominant, because of von Neumann computers





Data and programs stored in memory
Memory is separate from CPU
Instructions and data are piped from memory to CPU
Basis for imperative languages
• Variables model memory cells
• Assignment statements model piping
• Iteration is efficient (because instructions are stored in adjacent cells of memory)

Copyright © 2006 Addison-Wesley. All rights reserved.

1-12

The von Neumann Architecture

Copyright © 2006 Addison-Wesley. All rights reserved.

1-13

Programming Methodologies Influences
• 1950s and early 1960s: Simple applications; worry about machine efficiency
• Late 1960s: People efficiency became important; readability, better control structures
– structured programming
– top-down design and step-wise refinement

• Late 1970s: Process-oriented to data-oriented
– data abstraction

• Middle 1980s: Object-oriented programming
– Data abstraction + inheritance + polymorphism

Copyright © 2006 Addison-Wesley. All rights reserved.

1-14

Language Categories
• Imperative
– Central features are variables, assignment statements, and iteration – Examples: C, Pascal

• Functional
– Main means of making computations is by applying functions to given parameters
– Examples: LISP, Scheme

• Logic
– Rule-based (rules are specified in no particular order)
– Example: Prolog

• Object-oriented
– Data abstraction, inheritance, late binding
– Examples: Java, C++

• Markup
– New; not a programming language, but used to specify the layout of information in Web documents
– Examples: XHTML, XML
Copyright © 2006 Addison-Wesley. All rights reserved.

1-15

Language Design Trade-Offs
• Reliability vs. cost of execution
– Conflicting criteria
– Example: Java demands all references to array elements be checked for proper indexing but that increases execution costs

• Readability vs. writability
– Another conflicting criteria
– Example: APL provides many powerful operators (and a large number of new symbols), allowing complex computations to be written in a compact program but at the cost of poor readability

• Writability (flexibility) vs. reliability
– Another conflicting criteria
– Example: C++ pointers are powerful and very flexible but not reliably used
Copyright © 2006 Addison-Wesley. All rights reserved.

1-16

Implementation Methods
• Compilation
– Programs are translated into machine language • Pure Interpretation
– Programs are interpreted by another program known as an interpreter

• Hybrid Implementation Systems
– A compromise between compilers and pure interpreters
Copyright © 2006 Addison-Wesley. All rights reserved.

1-17

Layered View of Computer
The operating system and language implementation are layered over
Machine interface of a computer Copyright © 2006 Addison-Wesley. All rights reserved.

1-18

Compilation
• Translate high-level program (source language) into machine code (machine language)
• Slow translation, fast execution
• Compilation process has several phases:
– lexical analysis: converts characters in the source program into lexical units
– syntax analysis: transforms lexical units into parse trees which represent the syntactic structure of program
– Semantics analysis: generate intermediate code
– code generation: machine code is generated

Copyright © 2006 Addison-Wesley. All rights reserved.

1-19

The Compilation Process

Copyright © 2006 Addison-Wesley. All rights reserved.

1-20

Additional Compilation Terminologies
• Load module (executable image): the user and system code together
• Linking and loading the process of loading: collecting system program and linking them to user program

Copyright © 2006 Addison-Wesley. All rights reserved.

1-21

Execution of Machine Code
• Fetch-execute-cycle (on a von Neumann architecture) initialize the program counter repeat forever fetch the instruction pointed by the counter increment the counter decode the instruction execute the instruction end repeat

Copyright © 2006 Addison-Wesley. All rights reserved.

1-22

Von Neumann Bottleneck
• Connection speed between a computer’s memory and its processor determines the speed of a computer
• Program instructions often can be executed a lot faster than the above connection speed; the connection speed thus results in a bottleneck
• Known as von Neumann bottleneck; it is the primary limiting factor in the speed of computers Copyright © 2006 Addison-Wesley. All rights reserved.

1-23

Pure Interpretation
• No translation
• Programs are interpreted by another program called an interpreter.
• Easier implementation of programs (run-time errors can easily and immediately displayed)
• Slower execution (10 to 100 times slower than compiled programs)
• Often requires more space
• Becoming rare on high-level languages
• Significant comeback with some Web scripting languages (e.g., JavaScript)
Copyright © 2006 Addison-Wesley. All rights reserved.

1-24

Pure Interpretation Process

Copyright © 2006 Addison-Wesley. All rights reserved.

1-25

Hybrid Implementation Systems
• A compromise between compilers and pure interpreters • A high-level language program is translated to an intermediate language that allows easy interpretation
• Faster than pure interpretation
• Examples
– Perl programs are partially compiled to detect errors before interpretation
– Initial implementations of Java were hybrid; the intermediate form, byte code, provides portability to any machine that has a byte code interpreter and a run-time system (together, these are called Java Virtual Machine)
Copyright © 2006 Addison-Wesley. All rights reserved.

1-26

Hybrid Implementation Process

Copyright © 2006 Addison-Wesley. All rights reserved.

1-27

Just-in-Time Implementation Systems
• Initially translate programs to an intermediate language
• During execution, it compiles intermediate code into machine code when they are called
• Machine code version is kept for subsequent calls • JIT systems are widely used for Java programs • .NET languages are implemented with a JIT system Copyright © 2006 Addison-Wesley. All rights reserved.

1-28

Preprocessors
• Preprocessor macros (instructions) are commonly used to specify that code from another file is to be included
• A preprocessor processes a program immediately before the program is compiled to expand embedded preprocessor macros
• A well-known example: C preprocessor
– expands #include, #define, and similar macros Copyright © 2006 Addison-Wesley. All rights reserved.

1-29

Programming Environments
• The collection of tools used in software development • UNIX
– An older operating system and tool collection
– Nowadays often used through a GUI (e.g., CDE, KDE, or
GNOME) that run on top of UNIX

• Borland JBuilder
– An integrated development environment for Java

• Microsoft Visual Studio.NET
– A large, complex visual environment
– Used to program in C#, Visual BASIC.NET, Jscript, J#, or
C++
Copyright © 2006 Addison-Wesley. All rights reserved.

1-30

Summary
• The study of programming languages is valuable for a number of reasons:
– Increase our capacity to use different constructs
– Enable us to choose languages more intelligently
– Makes learning new languages easier

• Most important criteria for evaluating programming languages include:
– Readability, writability, reliability, cost

• Major influences on language design have been machine architecture and software development methodologies • The major methods of implementing programming languages are: compilation, pure interpretation, and hybrid implementation
Copyright © 2006 Addison-Wesley. All rights reserved.

1-31

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Newport News County has a T-Ball league in Hampton, VA situated in the Mallory community. . This is a part of a large community of the local T-Ball and youth league programs offered in the area. The league is for young children between the ages of four and seven. The league is for building character, teaching team work and development. Each T-ball team consists of 12-14 kids from all the surrounding cities. The league allows for parents to come in and volunteer as a means to save cost. Though all cities don't have a team, those that have teams are named after current MLB team names.…

    • 545 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Garbage Collector in C#: Runtime has a Garbage Collector Which cleans the objects that are not in use.…

    • 485 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Structured Query Language (SQL) is a standard database computer language used for querying, modifying and managing data in Relational Database Management Systems (RDBMS). SQL was developed in the 1970's by IBM to initially manipulate and retrieve data in IBM System R. The SQL language was standardized in 1986 by the American National Standards Institute (ANSI); however, later releases were released as International Organization for Standardization (ISO) standards.…

    • 612 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 An Introduction to Hardware, Software, and the Internet An Introduction to Software Development Objects and Classes Algorithms Java Syntax and Style Data Types, Variables, and Arithmetic Boolean Expressions and if-else Statements Iterative Statements: while, for, do–while Implementing Classes and Using Objects Strings Class Hierarchies and Interfaces Arrays…

    • 3908 Words
    • 16 Pages
    Powerful Essays
  • Good Essays

    pt1420 exam review

    • 738 Words
    • 3 Pages

    What is used to translate high level language programs to machine language (or machine code)? Compiler…

    • 738 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    EAS230Syllabus

    • 1748 Words
    • 8 Pages

    C++ programming: editing, compiling, user I/O, variables (ints, doubles, char, strings, booleans), loops, decisions, functions, pointers, arrays, tables, databases, sorting.…

    • 1748 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    Is that they produce female eggs cell as needed and they are called ova or…

    • 325 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Cs Programming Chapter 1

    • 2450 Words
    • 10 Pages

    ____ data items may involve organizing or sorting them, checking them for accuracy, or performing calculations with them.…

    • 2450 Words
    • 10 Pages
    Satisfactory Essays
  • Good Essays

    “Code Talker”, by Joseph Bruchac is about the life of a Navajo boy growing into a man. It describes his life as a child on an Indian Reservation up to adulthood. The story is told through the main character’s point of view, thoughts and actions. The book tells of the difficulties that the Navajo people faced in the white man’s world. It tells of the life lessons that the difficulties taught the Navajo boy. It addresses the overall values of the Navajo people and how they were treated by the white men. The book develops into the story of how the main character accepted his role in World War II as a Code Talker. The role of the main character and other Navajo young men contributed to the success of the United States Marines winning the war.…

    • 533 Words
    • 3 Pages
    Good Essays
  • Good Essays

    I follow various strategies to manage deadlines, manage time and stress everyday in my work life…

    • 2913 Words
    • 12 Pages
    Good Essays
  • Powerful Essays

    |1.2 Demonstrate an understanding of the |Code listings show a variety of objects | |…

    • 2281 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    Intro the Programming

    • 386 Words
    • 5 Pages

    In general terms, a program that is broken into smaller units of code, such as methods, is known as a(n) _______.…

    • 386 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    1.) There have been several versions of SQL created in the last 26 years. In 1986, SQL-86 (SQL-87) was first published. In 1989, SQL-89 was a minor revision made to the original SQL. In 1992, SQL-92 (SQL2) was a major revision to its previous version. In 1999, SQL-99 (SQL3) added regular expression matching, recursive queries, triggers, non scalar types and some object oriented features. In 2003, SQL-2003 introduced XML related features, standardized sequences, and columns with auto generated values. In 2006, SQL-2006 defined ways in which SQL can be used in conjunction with XML and it defined ways of importing and storing XML data in an SQL database, manipulating it within the database and publishing both XML and conventional SQL-data in XML form. It also enables applications to integrate into their SQL code the use of XQuery. In 2008, SQL-2008 Legalized ORDER BY outside cursor definitions, added INSTEAD OF triggers, and added the TRUNCATE statement. As of March 2012, the newest SQL was released its new features include AlwaysOn SQL Server Failover Cluster Instances and Availability Groups which provides a set of options to improve database availability, Contained Databases which simplify the moving of databases between instances, new and modified Dynamic Management Views and Functions, programmability enhancements including new Spatial features, Metadata discovery, Sequence objects and the THROW statement, performance enhancements such as ColumnStore Indexes as well as improvements to OnLine and Partition level operations and security enhancements including Provisioning During Setup, new permissions, improved role management and default schema assignment for groups…

    • 701 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Intro to programming

    • 534 Words
    • 3 Pages

    Design an algorithm that prompts the user to enter his or her height and stores the user’s input in a variable named height.…

    • 534 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Personal Career Goals

    • 783 Words
    • 4 Pages

    Computer technology has gone from being undiscovered to being used globally. We live in an exciting time technologically. Over relatively short spans of time, technology has improved our lives in many ways. Advances in computing and technology save lives, make day-to-day living easier, and have improved quality of life for billions of people. The impact that computing has on the world is fascinating to me. I have spent the last few years studying programming, software development, and computer programming and have felt great satisfaction in learning about what makes up this computing technology.…

    • 783 Words
    • 4 Pages
    Good Essays