CS 6371: Advanced Programming Languages



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

Department of Computer & Information Sciences. INFO-450: Information Systems Security Syllabus

CSE 307: Principles of Programming Languages

CSCI 3136 Principles of Programming Languages

Software Development Foundations CPSC Spring 2014 Syllabus

Fundamentals of Programming Languages

Department of Computer & Information Sciences. CSCI-445: Computer and Network Security Syllabus

CS 341: Foundations of Computer Science II elearning Section Syllabus, Spring 2015

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

CS 300 Data Structures Syllabus - Fall 2014

LANGARA COLLEGE Course Outline

CS 170 Java Programming 1. Welcome to CS 170. All about CS 170 The CS 170 Online Materials Java Mechanics: Your First Program

Introduction to programming

Chapter 12 Programming Concepts and Languages

Week 2 Practical Objects and Turtles

Programming Languages

Introduction to Computer Forensics Course Syllabus Spring 2012

: Foundations of Game Programming

Canisius College Computer Science Department Computer Programming for Science CSC107 & CSC107L Fall 2014

MINNESOTA STATE UNIVERSITY, MANKATO Department of Speech Communication Mankato, MN 56001

Programming Languages

CSC 314: Operating Systems Spring 2005

Introduction to Programming System Design. CSCI 455x (4 Units)

SYLLABUS. BOOK AUTHOR ED YEAR PUBLISHER ISBN# REVIEW Managing Human Resources

POL 204b: Research and Methodology

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

Introduction to Computer Programming Course Syllabus Fall 2015

The programming language C. sws1 1

CS 1361-D10: Computer Science I

CS 106 Introduction to Computer Science I

CS 1340 Sec. A Time: 8:00AM, Location: Nevins Instructor: Dr. R. Paul Mihail, 2119 Nevins Hall, rpmihail@valdosta.

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Software Engineering Techniques

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

The course assumes successful completion of CSCI E-50a and CSCI E-50b, i.e. at least two semesters of programming, with a grade of C- or better.

CS 40 Computing for the Web

6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang

ASSIGNMENT POLICY SETTINGS & BEST PRACTICES

CS422 - Programming Language Design

CS 450/650 Fundamentals of Integrated Computer Security

MATH 241: DISCRETE MATHEMATICS FOR COMPUTER SCIENCE, Winter CLASSROOM: Alumni Hall 112 Tuesdays and Thursdays, 6:00-8:15 pm

CS 496 Cloud and Mobile Software Development

SYLLABUS FOR CS340: INTRODUCTION TO DATABASES

TA: Matt Tong Tues EBU3b B225 - Office hour WLH Discussion Thurs EBU3b B250/B250A - Lab/Office hour

Fall 2012 Q530. Programming for Cognitive Science

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

What is a programming language?

CMSC Fundamentals of Computer Programming II (C++)

Programming in Python. Basic information. Teaching. Administration Organisation Contents of the Course. Jarkko Toivonen. Overview of Python

ACCT 3103 Intermediate Accounting I Oklahoma State University Spring 2015

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

CS 301 Course Information

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

Crash Course in Java

Computer Programming I

NURS 1050 Medical Terminology. Course Description

Semantic Analysis: Types and Type Checking

CHEM PRINCIPLES OF CHEMISTRY Lecture

Alabama Department of Postsecondary Education. Representing The Alabama Community College System

CSC230 Getting Starting in C. Tyler Bletsch

MATH 205 STATISTICAL METHODS

New York City College of Technology Computer Systems Technology Department

How To Learn To Program In Csc 406 Computer Graphics

MAC 2233, STA 2023, and junior standing

NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department. COURSE: CST2403 C++ Programming Part 1 ( 4 hours, 3 credits )

Major Topics Covered in the Course

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

How To Teach C++ Data Structure Programming

Applied Network Security Course Syllabus Spring 2015

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

CSC 341, section 001 Principles of Operating Systems Spring 2015 Monday/Wednesday 1:00 PM 2:15 PM

FIN 301 SYLLABUS Corporate Finance Spring 2012

CSE 130 Programming Language Principles & Paradigms

C# and Other Languages

CS1010 Programming Methodology A beginning in problem solving in Computer Science. Aaron Tan 20 July 2015

RARITAN VALLEY COMMUNITY COLLEGE COURSE OUTLINE. CISY 103 Computer Concepts and Programming

02-201: Programming for Scientists

Introduction to Developmental Psychology: Lifespan Psychology 111

UNIVERSITY OF SOUTHERN MISSISSIPPI COLLEGE OF SCIENCE & TECHNOLOGY Industrial Engineering Technology

MATH 2103 Business Calculus Oklahoma State University HONORS Spring 2015 Instructor: Dr. Melissa Mills 517 Math Sciences

CSC 281 Automata and Algorithms Spring 2009

HIST 2111 U.S. History Survey From the Beginning to 1890 Kennesaw State University Fall 2013

IINF 202 Introduction to Data and Databases (Spring 2012)

PSY 303, Mehta, Spring 2014 Page 1

Other Requirements: USB drive, Internet Access and a campus address.

EECS 354 Network Security. Introduction

ISM 4403 Section 001 Advanced Business Intelligence 3 credit hours. Term: Spring 2012 Class Location: FL 411 Time: Monday 4:00 6:50

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

Adam David Roth MESSAGE FROM THE BASIC COURSE DIRECTOR. Dear students:

INFO B512 Scientific and Clinical Data Management

BA 561: Database Design and Applications Acct 565: Advanced Accounting Information Systems Syllabus Spring 2015

Introduction to the course, Eclipse and Python

Course Syllabus: Marketing Research

Transcription:

CS 6371: Advanced Programming Languages Dr. Kevin Hamlen Spring 2014 Fill out, sign, and return prereq forms: Course number: CS 6371 Section: 1 Prerequisites: CS 5343: Algorithm Analysis & Data Structures CS 5349: Automata Theory

Today s Agenda Course overview and logistics Course philosophy and motivation What is an advanced programming language? Type-safe vs. Unsafe languages Functional vs. Imperative programming Introduction to OCaml The OCaml interpreter and compiler An OCaml demo

Course Overview How to design a new programming language specifying language formal semantics bad language design and the software crisis new programming paradigms: functional & logic how to formally prove program correctness Related courses CS 4337: Organization of Programming Languages CS 5349: Automata Theory CS 6353: Compiler Construction CS 6367: Software Verification & Testing

Course Logistics Class Resources: Course homepage: www.utdallas.edu/~hamlen/cs6371sp14.html My homepage: www.utdallas.edu/~hamlen Tentative office hours: 1 hr immediately after each class(?) Email: hamlen AT utdallas DOT edu Grading Homework: 25% In-class quizzes: 15% Midterm exam: 25% Final exam: 35% Homework 9 assignments: 6 programming + 3 written Homework must be turned in by 1:05pm on the due date. Programming assignments submitted through elearning; written assignments submitted in hardcopy at start of class. Late homeworks NOT accepted! Attendance of at least 2 of first 3 classes is MANDATORY.

Homework Policy Students MAY work together with other current students on homeworks You MAY NOT consult homework solution sets from prior semesters (or collaborate with students who are consulting them). CITE ALL SOURCES includes webpages, books, other people, etc. citation is required even if you don t copy the source word-for-word there is nothing wrong with using someone else s ideas as long as you cite it you will not lose any marks or credit as long as you cite Violating the above policies is PLAGIARISM (cheating). Cheating will typically result in automatic failure of this course and possible expulsion from the CS program. It is much better to leave a problem blank than to cheat! Usually ~60% is a B and ~80% is an A. However, cheating earns you an F. It s not worth it!

Quizzes in-class on specified homework due dates about 15-20 min. each approximately 1 quiz per unit, so about 8 total lowest one dropped, so you can miss one without penalty other misses only permitted in accordance with university policy (e.g., illness with doctor s note, etc.) closed-book, closed-notes think of them as extensions to the homework length/difficulty similar to 1 or 2 homework problems to prepare, be sure you can solve most recent homework without group help

Difficulty Level Warning: This is a tough course cutting-edge, PhD-level material difficulty ranked 9/9 on average by past students No required text book very few (approachable) texts cover this advanced material no large pools of sample problems exist to my knowledge useful texts: book by Glynn Winskel on reserve in UTD library online text and several online manuals linked from webpage Warning: Many online web resources devoted to this material are INCORRECT (e.g., certain Wikipedia pages). Do not depend on them. What you ll get out of taking this course excellent preparation for PhD APL qualifier exam solid understanding of language design & semantics modern issues in declarative vs. imperative languages deep connections between abstract logic and programming

About me Ph.D. from Cornell University (2006) B.S. in CS & Math from Carnegie Mellon Research: Computer Security, PL, Compilers Work experience: Microsoft Research Personal married, one child (a boy, 1 year old) Christian Programming habits C/C++ (for low-level work) assembly (malware reverse-engineering) C#, Java (toy programs) Prolog (search-based programs) OCaml, F#, Haskell, Gallina/Coq (everything else)

Course Plan Running case-study: We will design and implement a new programming language Code an interpreter in OCaml OCaml ( Objective Categorical Abstract Meta- Language ) is an open-source variant of ML Microsoft F# is OCaml for.net (but not fully compatible with OCaml, so don t use it for homework) Warning: OCaml has a STEEP learning curve! Pre-homework: Install OCaml Go to the course website and follow the instructions entitled To Prepare for the Course by next time

What is an Advanced Programming Language?

C/C++: Unsafe Languages Find the bug: #include <stdio.h> int main() { char name[1024]; printf( Enter your name: ); gets(name); printf( Your name is: %s\n, name); return 0; }

C/C++: Unsafe Languages Find the bug: #include <stdio.h> Buffer Overflow! int main() { char name[1024]; printf( Enter your name: ); gets(name); printf( Your name is: %s\n, name); return 0; } C/C++ lets you write programs that seg fault Some language features cannot be used safely! Most of the software crashes you experience are a direct result of the unsafe design of C/C++

Java: A Type-safe, Imperative Find two bugs: Language import java.io.*; import java.util.*; class Summation { public static void main(string[] args) { List list = new LinkedList(); for (int i=0; i<args.length; ++i) list.add(args[i]); int sum = 0; while (!list.isempty()) sum += ((Integer)list.remove(1)).intValue(); } } System.out.println(sum);

Java: A Type-safe, Imperative Language Find two bugs: import java.io.*; import java.util.*; OutOfBounds Exception! class Summation { public static void main(string[] args) { List list = new LinkedList(); Cast Exception! for (int i=0; i<args.length; ++i) list.add(args[i]); int sum = 0; while (!list.isempty()) sum += ((Integer)list.remove(1)).intValue(); } } System.out.println(sum);

Problems with Java Every Java cast operation is a potential crash In Java, a crash is an uncaught exception instead of a seg fault Some typecasting issues can be solved with Generics, but not all (e.g., list emptiness check) Problem: Java relies on programmer-supplied typing annotations

Goals of Functional Languages In an Advanced Programming Language: The compiler should tell you about typing errors in advance (not at runtime!) The language structure should make it difficult to write programs that might crash (no unsafe casts!) 80% of your time should be spent getting the program to compile, and only 20% on debugging should be tractable to create a formal, machinecheckable proof of correctness for mission-critical core routines, or even full production-level apps

In OCaml You almost never need to cast anything The compiler figures out all the types for you If there s a type-mismatch, the compiler warns you OCaml is fast Somewhere between C (fastest) and Java (slow) Very hard to measure precisely. (So-called benchmark programs typically rely on math libraries that aren t even implemented in the languages that call them!) Functions are first-class : you can pass them around as values, assign them to variables, you can build them at runtime (Runtime Code Generation) But: The syntax is very weird if you ve only ever programmed in imperative languages!

OCaml: Getting Started OCaml programs are text files (*.ml) Write them using any text editor (e.g., Notepad) Unix: Emacs has syntax highlighting for ML/OCaml Windows: I use Vim (www.vim.org) Installing OCaml (see course website) Unix: pre-installed on cs1.utdallas.edu Windows: Self-installers for native x86 and for Cygwin Two ways to use OCaml: The OCaml compiler: ocamlc (compile *.ml to binary) OCaml in interactive mode (use OCaml like a calculator) Demo