CSCI 3370: Principles of Programming Languages Introduction

Slides:



Advertisements
Similar presentations
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Advertisements

Chapter 1: Preliminaries
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 354 Overview. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Course Topics What is a programming language? What features do programming.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Programming Language Concepts
Chapter 1 Preliminaries.
Chapter 1 Preliminaries. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming Languages.
CS 355 – Programming Languages
CS 363 Comparative Programming Languages
CS 330 Programming Languages 09 / 04 / 2008 Instructor: Michael Eckmann.
Programming Languages Summer
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
ICS 313 Fundamentals of Programming Languages Instructor: Abdul Wahid Wali Lecturer, CSSE, UoH
ISBN Chapter 1 Preliminaries. Corrected and improved by Assoc. Prof. Zeki Bayram, EMU, North Cyprus. Original Copyright © 2007 Addison-Wesley.
ISBN CS 354 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Course Topics What is a programming language? What features.
ISBN Chapter 1 Preliminaries. Copyright © 2015 Pearson. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming.
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Concepts of Programming Languages
Chapter 1 Preliminaries.
Concepts of Programming Languages
Why study programming languages?
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
PROGRAMMING LANGUAGES
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
CS 3304 Comparative Languages Fall 2011
Chapter 1 Introduction.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminary. Chapter 1 Preliminary 1.1 Reasons for Studying Concepts of Programming Languages Increased capacity to express ideas Improved.
Lecture 2 Concepts of Programming Languages
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
CS 3304 Comparative Languages Fall 2011
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Programming Languages, Preliminaries, History & Evolution
Reasons To Study Programming Languages
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Presentation transcript:

CSCI 3370: Principles of Programming Languages Introduction Dr. Vamsi Paruchuri University of Central Arkansas vparuchuri@uca.edu These slides are available at: http://faculty.uca.edu/~vparuchuri/3370.htm

What is a Programming Language? Definition: A programming language is a notational system for describing computation in machine-readable and human-readable form.

At the beginning, there was no programming languages… Machine code example: 1st column: memory address 2nd column: machine code in hex format

A question What’s the best car? What are the best shoes?

An answer Of course it depends on what you are doing Programming languages have many goals, including making it easy in your domain to: Write correct code Write fast code Write large projects Interoperate …

Another question Aren’t all cars the same? “4 wheels, a steering wheel, a brake – the rest is unimportant details” - YES - NO!! Standards help (easy to build roads and rent a car) But legacy issues dominate (why are cars/roads the width they are?)

Aren’t all PLs the same? Almost every language is the same Yes: Certain fundamentals appear almost everywhere (variables, abstraction, records, recursive definitions) No: Real differences at formal and informal levels TIOBE Programming Community Index: www.tiobe.com/index.php/content/paperinfo/tpci/index.html

Why? Increased capacity to express ideas Improved background for choosing appropriate languages Increased ability to learn new languages Better understanding of the significance of implementation

Programming Domains Scientific Applications Business Applications Fortran Business Applications COBOL Artificial Intelligence LISP, Prolog, Scheme Systems Programming ALGOL Web Programming JavaScript, PHP

Language Evaluation Criteria Readability The most important criterion Factors: Overall simplicity Too many features is bad Multiplicity of features is bad (e.g., a++, ++a) Operator Overloading Orthogonality Makes the language easy to learn and read Meaning is context independent A relatively small set of primitive constructs can be combined in a relatively small number of ways Every possible combination is legal Lack of orthogonality leads to exceptions to rules

Language Evaluation Criteria Readability factors (continued) Control statements goto Vs loops Defining data types and structures (e.g., Boolean variables) Syntax considerations Identifier forms and lengths Special words Form and meaning grep !?

Language Evaluation Criteria Writability Factors: Simplicity and orthogonality Support for abstraction (Process and Data) Expressivity (eg., count++ Vs. count = count+1) Reliability Type checking Exception handling Aliasing Readability and writability

Language Evaluation Criteria Cost Categories Training programmers to use language Writing programs Compiling programs Executing programs Optimization Language implementation system Reliability Maintaining programs Others: portability, generality, well- definedness

Picking a language Admittedly, semantics can be far down the priority list: What libraries are available? What do management, clients want? What is the de facto industry standard? What does my team already know? But: Nice thing about class: we get to ignore all that Technology leaders affect the answers Sound reasoning about programs requires semantics Mission-critical code doesn’t “seem to be right” Blame: the compiler vendor or you?

Von Neumann Architecture We use imperative languages, at least in part, because we use von Neumann machines Data and programs stored in same 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

Von Neumann Architecture

Von Neumann Architecture Stored-program computer in which an instruction fetch and a data operation cannot occur at the same time because they share a common bus. This is referred to as the Von Neumann bottleneck and often limits the performance of the system. On a large scale, the ability to treat instructions as data is what makes assemblers, compilers and other automated programming tools possible. A stored-program design also allows for self- modifying code.

Von Neumann bottleneck The shared bus between the program memory and data memory leads to the limited throughput (data transfer rate) between the CPU and memory compared to the amount of memory. Because program memory and data memory cannot be accessed at same time, throughput is much smaller than rate at which the CPU can work. This seriously limits the effective processing speed when the CPU is required to perform minimal processing on large amounts of data. The CPU is continually forced to wait for needed data to be transferred to or from memory.

Influences on Language Design Programming methodologies 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

Language Design Trade-Offs Reliability vs. cost of execution Array bounds Readability vs. writability Flexibility vs. safety Pointers

Layered View of Computer

Language translation Compiler: two-step process that translates source code into target code; then the user executes the target code. Interpreter: one-step process in which the source code is executed directly. Hybrids are also possible (Java, C#).

Compilation Process - Translate high-level program to machine code - Slow translation - Fast execution

Implementation Methods Pure interpretation No translation Slow execution Becoming rare E.g., JavaScript, PHP

Implementation Methods Hybrid implementation systems Small translation cost Medium execution speed E.g., Perl, Java JIT

Programming Environments The collection of tools used in software development UNIX An older operating system and tool collection 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++

Language definition Syntax: How to write the structure of a program. Usually given a formal (i.e., mathematical) definition using a context-free language. (Lexical structure - the structure of the words or tokens - uses regular expressions.) Semantics: What does it mean the actual result of execution. Usually described in English, but can be done mathematically. Semantics can have a static component: type checking, definition checking, other consistency checks prior to execution and a dynamic component.

Summary Language description consists of Syntax Specification and a Semantics Specification. Syntax describes what programs look like; Semantics describes what they mean.