Image credits: http://xkcd.com/353/



Similar documents
Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Chapter 1. Dr. Chris Irwin Davis Phone: (972) Office: ECSS CS-4337 Organization of Programming Languages

1/20/2016 INTRODUCTION

COS 301 Programming Languages

What is a programming language?

n Introduction n Art of programming language design n Programming language spectrum n Why study programming languages? n Overview of compilation

CSE 130 Programming Language Principles & Paradigms

CSCI 3136 Principles of Programming Languages

Programming Languages

CSE 307: Principles of Programming Languages

CSC Software II: Principles of Programming Languages

Fall 2012 Q530. Programming for Cognitive Science

Levels of Programming Languages. Gerald Penn CSC 324

Lecture 1: Introduction

CS 51 Intro to CS. Art Lee. September 2, 2014

Programming Languages

CS 40 Computing for the Web

CS 253: Intro to Systems Programming

Programming Languages

Evolution of the Major Programming Languages

Chapter 13: Program Development and Programming Languages

Chapter 13: Program Development and Programming Languages

System Structures. Services Interface Structure

McGraw-Hill The McGraw-Hill Companies, Inc.,

Jonathan Worthington Scarborough Linux User Group

The programming language C. sws1 1

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

El Dorado Union High School District Educational Services

Chapter 5 Names, Bindings, Type Checking, and Scopes

BCS Higher Education Qualifications. Professional Graduate Diploma in IT. Programming Paradigms Syllabus

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Chapter 12 Programming Concepts and Languages

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

Computer Science. Computer Science 207. Degrees and Certificates Awarded. A.S. Computer Science Degree Requirements. Program Student Outcomes

CSCI E 98: Managed Environments for the Execution of Programs

Some programming experience in a high-level structured programming language is recommended.

Semester Review. CSC 301, Fall 2015

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari:

02-201: Programming for Scientists

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014

A Python Tour: Just a Brief Introduction CS 303e: Elements of Computers and Programming

Introduction. What is an Operating System?

Curriculum Map. Discipline: Computer Science Course: C++

DM810 Computer Game Programming II: AI. Lecture 11. Decision Making. Marco Chiarandini

Python Programming: An Introduction to Computer Science

Computer Science. Computer Science 213. Faculty and Offices. Degrees and Certificates Awarded. AS Computer Science Degree Requirements

How To Understand Programming Languages And Programming Languages

Chapter 3: Operating-System Structures. Common System Components

Efficiency Considerations of PERL and Python in Distributed Processing

General Introduction

Chapter 3.2 C++, Java, and Scripting Languages. The major programming languages used in game development.

Announcements FORTRAN ALGOL COBOL. Simula & Smalltalk. Programming Languages

Moving from CS 61A Scheme to CS 61B Java

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

Structure of Presentation. The Role of Programming in Informatics Curricula. Concepts of Informatics 2. Concepts of Informatics 1

CS A250 (CRN ) C++ Programming Language 2. Syllabus Fall 2015

#820 Computer Programming 1A

Texas Essential Knowledge and Skills Correlation to Video Game Design Foundations 2011 N Video Game Design

1.1 WHAT IS A PROGRAMMING LANGUAGE?

Syllabus for CS 134 Java Programming

Computer Science. 232 Computer Science. Degrees and Certificates Awarded. A.S. Degree Requirements. Program Student Outcomes. Department Offices

The C Programming Language course syllabus associate level

CSC 2405: Computer Systems II

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Sample Syllabus (C++) CSCI 1301 Introduction to Programming Principles

1. Overview of the Java Language

Programming and Software Development CTAG Alignments

HPC Wales Skills Academy Course Catalogue 2015

CMSC Fundamentals of Computer Programming II (C++)

Fundamentals of Programming Languages

Good FORTRAN Programs

MICHIGAN TEST FOR TEACHER CERTIFICATION (MTTC) TEST OBJECTIVES FIELD 050: COMPUTER SCIENCE

Manage Software Development in LabVIEW with Professional Tools

DOVER-SHERBORN HIGH SCHOOL PROGRAM OF STUDIES

Introduction to the course, Eclipse and Python

Computer Programming I

Domains and Competencies

International Engineering Journal For Research & Development

Language Processing Systems

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Python Programming: An Introduction to Computer Science

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Programming Languages

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

CS 378: Computer Game Technology

ATSBA: Advanced Technologies Supporting Business Areas. Programming with Java. 1 Overview and Introduction

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

ABET General Outcomes. Student Learning Outcomes for BS in Computing

Lesson 06: Basics of Software Development (W02D2

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

COURSE CSE1010: COMPUTER SCIENCE 1. Prerequisite:

THE ROLE OF PROGRAMMING PARADIGMS IN THE FIRST PROGRAMMING COURSES. 1. Introduction

Software: Systems and. Application Software. Software and Hardware. Types of Software. Software can represent 75% or more of the total cost of an IS.

Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course

Transcription:

Image credits: http://xkcd.com/353/

CS 354: Programming Languages Alark Joshi Copyright 2009 Addison-Wesley. All rights reserved.

Contact Information Email: alarkjoshi@boisestate.edu Course Website: o http://cs.boisestate.edu/~alark/cs354 Office: MEC 302A Office Hours: o Monday, Friday : 10-11am o Tuesday, Thursday: 3-4pm o Doodle poll

TA Information Teaching Assistant Nathan Riskey o nathanriskey@u.boisestate.edu o Graduate Student o Work experience Office hours: To be announced soon

Administrivia Roll call sheet going around Please sign and note your team assignment Piazza instead of a mailing list o https://piazza.com/boisestate/fall2012/compsc i354 o Better at managing responses, replies, helping each other through assignments, homework, projects etc.

Textbook & Resources Concepts of Programming Languages by Richard Sebesta, Addison Wesley publishing, 9th Edition, 2009. Course Wiki: o cs354.pbworks.com o Collaborative resource o Feel free to edit and improve

Why study languages/programming languages? Look to the person sitting next to you Introduce yourself Make the longest list of reasons you can think of in 2 minutes Longest list in class wins! Go!!! I will call on you to share from your list

Reasons from Sebesta 1. Increased capacity to express ideas 2. Improved background for choosing appropriate languages 3. Increased ability to learn new languages 4. Better understanding of the significance of implementation 5. Better use of languages that are already known 6. Overall advancement of computing

Grade Breakdown Quizzes 21% Interpreter assignment 15% Programming assignments 15% Homework 14% Final project - 35% o Create a website for a programming language o Work on a project using that programming language

Final Project P1 - Website for learning a new language: weebly, pbworks or any other P2 - Create a detailed manual or YouTube video with details regarding installation, IDE setup and other relevant issues P3 - include 10/15 examples of increasing difficulty to teach a novice about that programming language

Final Project P4 - Update website with a comprehensive list of relevant resources, books, tutorials, videos, etc. P5 - Propose 3 projects to me (and anonymous reviewers) - We pick one for you to implement by the end of the semester P6-5-min presentation in the class about your project and what you propose to do

Final Project P7 - Incorporate feedback from anonymous reviewers to improve your website P8 In-class presentation (25-mins) Final grade of the project based on o Quality of the website o Ability to follow along for reviewers o Quality of final project o Relevant documentation

Anonymous reviewers Each student and some external software partners will serve as anonymous reviewers Code review for programs and final project Monthly reports on the quality of the website and the status of the project as described on the website

Programming Assignments Interpreter assignments o V1 and V2 worth 15% Three language related assignments o C# - 5% Assignment available Due 10 th Sept o Python - 5% o Scheme/ML/Haskell - 5%

Team-Based Learning Long Lectures have been shown to produce significant reduction in understanding as the lecture progresses Team-based learning o Apply o Question o Reflect upon and o Discuss content in a group

TBL Quizzes Each quiz will be taken first as an individual Same quiz will be taken as a team o Instant feedback for the team TBL quizzes individual vs team performance Quizzes 21% of the final grade o Quiz 1 - Chapter 1 of Sebesta on 5 th Sept

Team Assignments Teams assignments are going around Please meet your team now! o Buzz Lightyear o Dory o Merida o Nemo o Remy o Sulley o Wall-E

Languages 1. Python 2. Javascript 3. CUDA 4. Lua 5. Haskell 6. C++ 7. Ruby 8. Actionscript 9. Objective-C 10. Perl 11. Processing 12. Lisp 13. Matlab 14. R Image credits: http://xkcd.com/519/

Language Evaluation Criteria Course objective #6: o Evaluate a language on the basis of the various features which it supports. How would you evaluate a language? Think-pair-share (2-2-2) o 2 mins to think of metrics you would use o 2 mins to share it with your partner/team o 2 mins to share with the class

Language Evaluation Criteria Readability Writability Reliability Cost

Readability The ease with which programs can be read and understood

Evaluation Criteria: Readability Overall simplicity o A manageable set of features and constructs o Minimal feature multiplicity o Minimal operator overloading Orthogonality o A relatively small set of primitive constructs can be combined in a relatively small number of ways o Every possible combination is legal

Evaluation Criteria: Readability Data types o Adequate predefined data types Syntax considerations o Identifier forms: flexible composition o Special words and methods of forming compound statements o Form and meaning: self-descriptive constructs, meaningful keywords

Writability The ease with which a language can be used to create programs

Evaluation Criteria: Writability Simplicity and orthogonality o Few constructs, a small number of primitives, a small set of rules for combining them Support for abstraction o The ability to define and use complex structures or operations in ways that allow details to be ignored Expressivity o A set of relatively convenient ways of specifying operations o Strength and number of operators and predefined functions

Reliability Conformance to specifications (i.e., performs to its specifications)

Evaluation Criteria: Reliability Type checking o Testing for type errors Exception handling o Intercept run-time errors and take corrective measures

Evaluation Criteria: Reliability Aliasing o Presence of two or more distinct referencing methods for the same memory location Readability and writability o A language that does not support natural ways of expressing an algorithm will require the use of unnatural approaches, and hence reduced reliability

Evaluation Criteria: Cost Training programmers to use the 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 Image credits - http://xkcd.com/303/

Evaluation Criteria: Others Portability o The ease with which programs can be moved from one implementation to another Generality o The applicability to a wide range of applications Well-definedness o The completeness and precision of the language s official definition

Influences on Language Design Computer Architecture o Languages are developed around the prevalent computer architecture, known as the von Neumann architecture Program Design Methodologies o New software development methodologies (e.g., object-oriented software development) led to new programming paradigms and by extension, new programming languages

The von Neumann Architecture

The 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

Computer Architecture Influence Well-known computer architecture: Von Neumann Imperative languages, most dominant, because of von Neumann computers o Data and programs stored in memory o Memory is separate from CPU o Instructions and data are piped from memory to CPU o Basis for imperative languages Variables model memory cells Assignment statements model piping Iteration is efficient

Programming Methodologies Influences 1950s and early 1960s: Simple applications; worry about machine efficiency Late 1960s: People efficiency became important; readability, better control structures o structured programming o top-down design and step-wise refinement Late 1970s: Process-oriented to data-oriented o data abstraction Middle 1980s: Object-oriented programming o Data abstraction + inheritance + polymorphism

Language Categories Imperative o Central features are variables, assignment statements, and iteration o Include languages that support object-oriented programming o Include scripting languages o Include the visual languages o Examples: C, Java, Perl, JavaScript, Visual BASIC.NET, C++ Functional o Main means of making computations is by applying functions to given parameters o Examples: LISP, Scheme, ML, F#

Language Categories Logic o Rule-based (rules are specified in no particular order) o Example: Prolog Markup/programming hybrid o Markup languages extended to support some programming o Examples: JSTL, XSLT, LaTeX

2-2-2 Language Design Trade-Offs Reliability vs. cost of execution o Example: Java demands all references to array elements be checked for proper indexing, which leads to increased execution costs Readability vs. writability o 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 o Example: C++ pointers are powerful and very flexible but are unreliable

Implementation Methods Compilation o Programs are translated into machine language; includes JIT systems o Use: Large commercial applications Pure Interpretation o Programs are interpreted by another program known as an interpreter o Use: Small programs or when efficiency is not an issue Hybrid Implementation Systems o A compromise between compilers and pure interpreters o Use: Small and medium systems when efficiency is not the first concern

Layered View of Computer The operating system and language implementation are layered over machine interface of a computer

Compilation vs. Interpretation Compilation vs. interpretation o not opposites o not a clear-cut distinction Pure Compilation o The compiler translates the high-level source program into an equivalent target program (typically in machine language), and then goes away:

Compilation vs. Interpretation Pure Interpretation o Interpreter stays around for the execution of the program o Interpreter is the locus of control during execution

Compilation vs. Interpretation Interpretation: o Greater flexibility o Better diagnostics (error messages) Compilation o Better performance

Compilation vs. Interpretation Common case is compilation or simple pre-processing, followed by interpretation Most language implementations - mixture of both compilation and interpretation

Compilation Compilation does NOT have to produce machine language for some sort of hardware Compilation is translation from one language into another, with full analysis of the meaning of the input

Compilation Compilation entails semantic understanding of what is being processed; pre-processing does not A pre-processor is a program that processes its input data to produce output that is used as input to another program (usually compiler) A pre-processor will often let errors through. A compiler hides further steps; a preprocessor does not

Compilation vs. Interpretation Implementation strategies: o Preprocessor Removes comments and white space Groups characters into tokens (keywords, identifiers, numbers, symbols) Expands abbreviations in the style of a macro assembler Identifies higher-level syntactic structures (loops, subroutines)

Compilation vs. Interpretation Implementation strategies: o Library of Routines and Linking Compiler uses a linker program to merge the appropriate library of subroutines (e.g., math functions such as sin, cos, log, etc.) into the final program:

Compilation vs. Interpretation Implementation strategies: o Post-compilation Assembly Facilitates debugging (assembly language easier for people to read) Isolates the compiler from changes in the format of machine language files (only assembler must be changed, is shared by many compilers)

Compilation vs. Interpretation Implementation strategies: o The C Preprocessor (conditional compilation) Preprocessor deletes portions of code, which allows several versions of a program to be built from the same source

Compilation vs. Interpretation Implementation strategies: o Source-to-Source Translation (C++) C++ implementations based on the early AT&T compiler generated an intermediate program in C, instead of an assembly language:

Compilation vs. Interpretation Implementation strategies: o Compilation of Interpreted Languages The compiler generates code that makes assumptions about decisions that won t be finalized until runtime. If these assumptions are valid, the code runs very fast. If not, a dynamic check will revert to the interpreter.

Compilation vs. Interpretation Implementation strategies: o Dynamic and Just-in-Time Compilation In some cases a programming system may deliberately delay compilation until the last possible moment. o Lisp and Prolog invoke the compiler on the fly, to translate newly created source into machine language

Compilation vs. Interpretation o Dynamic and Just-in-Time Compilation The Java language definition defines a machine-independent intermediate form known as byte code. Byte code is the standard format for distribution of Java programs. The main C# compiler produces.net Common Intermediate Language (CIL), which is then translated into machine code immediately prior to execution.

Compilation vs. Interpretation Compilers exist for some interpreted languages, but they aren't pure: o selective compilation of compilable pieces and extra-sophisticated pre-processing of remaining source. o Interpretation of parts of code, at least, is still necessary for reasons above. Unconventional compilers o text formatters o silicon compilers o query language processors

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 much faster than the speed of the connection; the connection speed thus results in a bottleneck Known as the von Neumann bottleneck; it is the primary limiting factor in the speed of computers

Robot Programming In groups of 2/3 select a robot and a robot master The Dictionary contains a list of commands that a robot understands Invent new commands

Robot Programming The goal is for the robot to go through a maze, move an object and reach the end Your sub-group will write a program that will be followed by the robot Every time you write a program, you hand it over to the robot who will follow the instructions Use a blank sheet of paper for every program 10 mins

Robot Game Analysis You invented a programming language to program a fictional robot o The commands you used/invented are the commands for your new programming language o The commands were executed by your robot o At times you didn t get the expected result which you found out by running the robot o Debugging and Re-execute