Language Evaluation P L COS 301. Fall School of Computing and Information Science University of Maine. Language Evaluation COS 301.

Similar documents
Chapter 5. Names, Bindings, and Scopes

Chapter 5 Names, Binding, Type Checking and Scopes

Chapter 1 Preliminaries

Chapter 1. Preliminaries

9/7/17. Outline. Name, Scope and Binding. Names. Introduction. Names (continued) Names (continued) In Text: Chapter 5

Principles of Programming Languages. Lecture Outline

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?


Chapter 1. Preliminaries

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Introduction Primitive Data Types Character String Types User-Defined Ordinal Types Array Types. Record Types. Pointer and Reference Types

Concepts of Programming Languages

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

Introduction. A. Bellaachia Page: 1

Programming Languages Third Edition. Chapter 7 Basic Semantics

CPS122 Lecture: From Python to Java last revised January 4, Objectives:

Chapter 5 Names, Bindings, Type Checking, and Scopes

Introduction to C++ with content from

Concepts of Programming Languages

Why study Programming Language Concepts? Chapter One. Language Evaluation Criteria. Programming Domains. Readability Writability Reliability Cost

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

Introduction to: Computers & Programming: Review prior to 1 st Midterm

Programmiersprachen (Programming Languages)

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

Data Types. Every program uses data, either explicitly or implicitly to arrive at a result.

Introduction to Programming Using Java (98-388)

PRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

CPS122 Lecture: From Python to Java

Lecture 12: Data Types (and Some Leftover ML)

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

Introduction. Primitive Data Types: Integer. Primitive Data Types. ICOM 4036 Programming Languages

1DL321: Kompilatorteknik I (Compiler Design 1)

CS508-Modern Programming Solved MCQ(S) From Midterm Papers (1 TO 22 Lectures) BY Arslan

COS 140: Foundations of Computer Science

What is a programming language?

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

COS 140: Foundations of Computer Science

Full file at

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

QUIZ. What is wrong with this code that uses default arguments?

Grade Weights. Language Design and Overview of COOL. CS143 Lecture 2. Programming Language Economics 101. Lecture Outline

Extending SystemVerilog Data Types to Nets

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Compilers. Prerequisites

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Programming Paradigms

ECE 486/586. Computer Architecture. Lecture # 7

QUIZ Friends class Y;

Chapter 6 part 1. Data Types. (updated based on 11th edition) ISBN

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

Programming Languages 2nd edition Tucker and Noonan"

Imperative Programming

Programming Languages, Summary CSC419; Odelia Schwartz

The role of semantic analysis in a compiler

Fundamentals of Programming Languages

CSI33 Data Structures

CSC 533: Organization of Programming Languages. Spring 2005

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Computer Components. Software{ User Programs. Operating System. Hardware

CS558 Programming Languages

Introduction to Programming Languages and Compilers. CS164 11:00-12:30 TT 10 Evans. UPRM ICOM 4029 (Adapted from: Prof. Necula UCB CS 164)

GIS 4653/5653: Spatial Programming and GIS. More Python: Statements, Types, Functions, Modules, Classes

22c:111 Programming Language Concepts. Fall Types I

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

Announcements. Working on requirements this week Work on design, implementation. Types. Lecture 17 CS 169. Outline. Java Types

Expressions and Assignment

Static Semantics. Winter /3/ Hal Perkins & UW CSE I-1

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Syntax Errors; Static Semantics

Expression Evaluation and Control Flow. Outline

Hacking in C. Pointers. Radboud University, Nijmegen, The Netherlands. Spring 2019

TYPES, VALUES AND DECLARATIONS

Chapter 3 Function Basics

Weeks 6&7: Procedures and Parameter Passing

09/02/2013 TYPE CHECKING AND CASTING. Lecture 5 CS2110 Spring 2013

UNIT V Sub u P b ro r g o r g a r m a s

CSE 431S Type Checking. Washington University Spring 2013

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

QUIZ. What are 3 differences between C and C++ const variables?

1DL321: Kompilatorteknik I (Compiler Design 1) Introduction to Programming Language Design and to Compilation

Chapter 6. Data Types

CS 430 Spring Mike Lam, Professor. Data Types and Type Checking

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Motivation for typed languages

Instruction Set Principles and Examples. Appendix B

Answer: Early binding generally leads to greater efficiency (compilation approach) Late binding general leads to greater flexibility

Subprograms. Bilkent University. CS315 Programming Languages Pinar Duygulu

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Lecture Overview. [Scott, chapter 7] [Sebesta, chapter 6]

Data Types. Outline. In Text: Chapter 6. What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 5-1. Chapter 6: Data Types 2

The New C Standard (Excerpted material)

C++ for Java Programmers

PROGRAMMING FUNDAMENTALS

Contents. Slide Set 1. About these slides. Outline of Slide Set 1. Typographical conventions: Italics. Typographical conventions. About these slides

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

CS558 Programming Languages

Transcription:

School of Computing and Information Science University of Maine Fall 2018

Outline 1 2 3 4 5

evaluation criteria

Early (pre-1970s): more important for machine to read code easily After: realized SW maintenance cost development cost Memory helped readability: Compilers/interpreters need system memory Ones for more readable l can be large Aspects of readability: Simplicity Orthogonaility Syntax

Simplicity Size of language feature set readability Subsets: Can readability E.g., writer & reader familiar with different ones Canonical features vs feature multiplicity: i=i+1; i++; ++i; i+=1; i=+1; Operator overloading readability E.g., + for floating point, integer, string concatenation j = "hi" + 4; Especially confusing: user-defined overloading

Orthogonality Large feature set or small primitive constructs that can be combined? Canonical: one and only one way to express something Primitive constructs all treated alike All combinations legal with all constructs All combinations behave same way More canonical readability Example: IBM instruction set had 2 opcodes for addition (reg reg, reg mem) DEC VAX had one Non-orthogonality in C C functions: can return struct but not array Struct member: can be anything except void or struct of same type Array elements: can be any data type except void or function Parameters: passed by value... except arrays

Syntax Identifiers impact readability Length Characters allowed Compound statement syntax: Deeply-nested {} (C-like) or () (Lisp-like) Deeply-indented Python code Choice of delimiters (spaces in Python, e.g.) Different meaning for same keyword readability static used inside C function variable retains memory/value across function invocations static used outside C function variable/function visible only within same file

How easy is it for a programmer to write a program? Could depend on purpose, level of language: e.g., C vs Python for writing a graphics-intensive game writing an embedded controller Also depends on: Simplicity and orthogonality Support for abstraction Expressivity

Simplicity/orthogonality Generally writability Large feature set, non-orthogonality may accidental use of unknown/inappropriate features E.g., C++ cout «(1 «2); cout «1 «2;

Simplicity/orthogonality Generally writability Large feature set, non-orthogonality may accidental use of unknown/inappropriate features E.g., C++ cout «(1 «2); prints 4 (2 0 shifted 2 times = 2 2 ) cout «1 «2;

Simplicity/orthogonality Generally writability Large feature set, non-orthogonality may accidental use of unknown/inappropriate features E.g., C++ cout «(1 «2); prints 4 (2 0 shifted 2 times = 2 2 ) cout «1 «2; prints 12

Abstraction Abstraction allows treating complex structures/operations as black boxes Support for abstraction writability Procedural abstraction: Output specified in terms of its relationship to inputs only Internals of procedure are opaque E.g.: sin(), cos(), user-defined procedures, etc. Data abstraction: Use representation of data appropriate for problem, regardless of implementation An interpretation of the underlying bits E.g.: floating point instead of bits arrays instead of contiguous integers objects user-defined data types

Expressivity Can language express what is needed for problem? Does language have convenient ways to specify operations? Number, power of operators expressivity Number predefined functions expressivity E.g.: COBOL: lots of operations for different file types APL: lots of math operations, convenient for mathematicians

Is the program produced by the language reliable? : safety correctness features: type checking exception handling aliasing readability/writability interactions

Type checking Type checking: insuring that operands compatible with operator data compatible with variables variables compatible with variables arguments compatible with formal parameters Compile-time or runtime? Runtime checking: expensive (e.g., C, etc.: none) Compile-time checking: may writability (e.g., Python, Lisp: little none) Strong, compile-time type checking reliability, readability Runtime type casting (Python, Lisp, others) writability, reliability

Exception handling Ways to handle runtime errors Most l have some way of handling exceptions Some don t (e.g., C) Security, correctness impacted by lack of exception handling

Aliasing Two more more names for or pointers to same thing memory location (e.g., pointer, name) object (reference, name) Aliasing reliability Most l suffer from this pass-by-reference parameters assigning references to multiple variables assigning pointers to multiple variables pointer computation arriving at same values Problem: multiple accesses to same location/object May not be obvious: change one, other magically changes Could lead to race conditions (in shared, multip environment)

/writability interactions Lack of expressiveness in language unnatural/convoluted algorithms and p Leads to reliability, readability Poor readability itself reliability readability makes it hard to catch/fix bugs, logic errors E.g.: APL, Perl facetiously: write-only l C: R2D2 s diary

Not what a compiler costs most are free anyway includes Time costs Direct monetary costs Other

Not what a compiler costs most are free anyway includes Time costs : Training programmer or programmer s time to learn Time required to write programs using the language Compilation speed (wastes time) Efficiency of execution issues bugs/security flaws time to fix Maintenance time Direct monetary costs Other

Not what a compiler costs most are free anyway includes Time costs : Training programmer or programmer s time to learn Time required to write programs using the language Compilation speed (wastes time) Efficiency of execution issues bugs/security flaws time to fix Maintenance time Direct monetary costs : Programmer s/maintainer s pay Lost opportunity due to delays selling product Not getting time-critical solution on time issues bugs/security flaws lost money Other

Not what a compiler costs most are free anyway includes Time costs : Training programmer or programmer s time to learn Time required to write programs using the language Compilation speed (wastes time) Efficiency of execution issues bugs/security flaws time to fix Maintenance time Direct monetary costs : Programmer s/maintainer s pay Lost opportunity due to delays selling product Not getting time-critical solution on time issues bugs/security flaws lost money Other : Privacy breaches Data loss Injury/death

Other evaluation criteria: Is the language portable? Is it general? Is the language well-defined?

, writability, reliability, and cost are all important However, trade-offs sometimes necessary: vs writability Polymorphism/operator overloading (+ in Python, e.g.) Special-purpose operators (e.g., APL) Complex language (e.g., PL/I) vs reliability Pointers in C, C++ Untyped l vs cost Quicker to build applications in Python, Lisp Runtime type checking, exception handling