Programming Languages (PL)

Similar documents
The Informatics curriculum on Programming Languages and ACM CS2013 curriculum guidelines DRAFT

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Principles of Programming Languages [PLP-2015] Detailed Syllabus

University of Engineering and Technology School of Computer Science Syllabus of Course Academic Period 2018-II

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

Course Outline Computing Science Department. Faculty of Science. COMP Credits Introduction to Computer Systems (3,1,0) Fall 2015

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Short Notes of CS201

JVM ByteCode Interpreter

Big Bang. Designing a Statically Typed Scripting Language. Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn

CS201 - Introduction to Programming Glossary By

LOGIC AND DISCRETE MATHEMATICS

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Programming in Scala Second Edition

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

COS 320. Compiling Techniques

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Software Development Fundamentals (SDF)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Chapter 1 SPECIFYING SYNTAX 1

St. MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

CS 415 Midterm Exam Spring 2002

Programming Languages Third Edition. Chapter 7 Basic Semantics

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

Programming Languages Third Edition

Fast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3. Course Code: GK1965. Overview

INSTITUTE OF AERONAUTICAL ENGINEERING

Syllabi of the Comprehensive Examination in Computer Science

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

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA


Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Java 8 Programming for OO Experienced Developers

Semantic Analysis and Type Checking

G COURSE PLAN ASSISTANT PROFESSOR Regulation: R13 FACULTY DETAILS: Department::

CS 415 Midterm Exam Fall 2003

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

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

Types and Type Inference

Principles of Compiler Construction ( )

Anatomy of a Compiler. Overview of Semantic Analysis. The Compiler So Far. Why a Separate Semantic Analysis?

5. Semantic Analysis!

The results for a few specific cases below are indicated. allequal ([1,1,1,1]) should return true allequal ([1,1,2,1]) should return false

Thanks! Review. Course Goals. General Themes in this Course. There are many programming languages. Teaching Assistants. John Mitchell.

Programming Languages Third Edition. Chapter 10 Control II Procedures and Environments

CMSC 330: Organization of Programming Languages

Introduction to Programming Using Java (98-388)

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

CSCI-GA Scripting Languages

Semantic Analysis. CSE 307 Principles of Programming Languages Stony Brook University

ADMINISTRATIVE MANAGEMENT COLLEGE

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CS 565: Programming Languages. Spring 2008 Tu, Th: 16:30-17:45 Room LWSN 1106

CS 406/534 Compiler Construction Putting It All Together

5. Semantic Analysis. Mircea Lungu Oscar Nierstrasz

Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages. Corky Cartwright Mathias Ricken October 20, 2010

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms

CSE 307: Principles of Programming Languages

CS-XXX: Graduate Programming Languages. Lecture 22 Class-Based Object-Oriented Programming. Dan Grossman 2012

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

Programming Languages, Summary CSC419; Odelia Schwartz

The Case for Simple Object-Orientation in VDM++ Erik Ernst Aarhus University, Denmark

0. Overview of this standard Design entities and configurations... 5

Cover Page. The handle holds various files of this Leiden University dissertation

Combined Object-Lambda Architectures

CS 480 Fall Runtime Environments. Mike Lam, Professor. (a.k.a. procedure calls and heap management)

Absolute C++ Walter Savitch

«Computer Science» Requirements for applicants by Innopolis University

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

11. a b c d e. 12. a b c d e. 13. a b c d e. 14. a b c d e. 15. a b c d e

Review. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals

Principles of Compiler Construction ( )

Chapter 3:: Names, Scopes, and Bindings (cont.)

Representation Independence, Confinement and Access Control

C++ for System Developers with Design Pattern

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

Functional Languages and Higher-Order Functions

Multi-paradigm Declarative Languages

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?

COMPILER DESIGN. For COMPUTER SCIENCE

Informatica 3 Syntax and Semantics

Chapter 6 Introduction to Defining Classes

Semester Review CSC 301

COMPILER CONSTRUCTION LAB 2 THE SYMBOL TABLE. Tutorial 2 LABS. PHASES OF A COMPILER Source Program. Lab 2 Symbol table

The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured

Type Systems, Type Inference, and Polymorphism

Curriculum 2013 Knowledge Units Pertaining to PDC

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 17: Types and Type-Checking 25 Feb 08

Transcription:

1 2 3 4 5 6 7 8 9 10 11 Programming Languages (PL) Programming languages are the medium through which programmers precisely describe concepts, formulate algorithms, and reason about solutions. In the course of a career, a computer scientist will work with many different languages, separately or together. Software developers must understand the programming models underlying different languages, and make informed design choices in languages supporting multiple complementary approaches. Computer scientists will often need to learn new languages and programming constructs, and must understand the principles underlying how programming language features are defined, composed, and implemented. The effective use of programming languages, and appreciation of their limitations, also requires a basic knowledge of programming language translation and static program analysis, as well as run-time components such as memory management. 12

13 PL. Programming Languages (8 Core-Tier1 hours, 20 Core-Tier2 hours) Core-Tier1 hours Core-Tier2 hours Includes Electives PL/Object-Oriented Programming 4 6 N PL/Functional Programming 3 4 N PL/Event-Driven and Reactive Programming 2 N PL/Basic Type Systems 1 4 N PL/Program Representation 1 N PL/Language Translation and Execution PL/Syntax Analysis PL/Compiler Semantic Analysis PL/Code Generation PL/Runtime Systems PL/Static Analysis PL/Advanced Programming Constructs PL/Concurrency and Parallelism PL/Type Systems PL/Formal Semantics PL/Language Pragmatics 3 N 14 15 16 17 18 19 20 21 22 23 24 25 PL/Logic Programming Note: Some topics from one or more of the first three Knowledge Units (Object-Oriented Programming, Functional Programming, Event-Driven and Reactive Programming) are likely to be integrated with topics in the Software Development Fundamentals Knowledge Area in a curriculum s introductory courses. Curricula will differ on which topics are integrated in this fashion and which are delayed until later courses on software development and programming languages. Some of the most important core learning outcomes are relevant to object-oriented programming, functional programming, and, in fact, all programming. These learning outcomes are repeated in the Object-Oriented Programming and Functional - 133 -

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 Programming Knowledge Units, with a note to this effect. We do not intend that a curriculum necessarily needs to cover them multiple times, though some will. We repeat them only because they do not naturally fit in only one Knowledge Unit. PL/Object-Oriented Programming [4 Core-Tier1 hours, 6 Core-Tier2 hours] Object-oriented design Decomposition into objects carrying state and having behavior Class-hierarchy design for modeling Definition of classes: fields, methods, and constructors Subclasses, inheritance, and method overriding Dynamic dispatch: definition of method-call 42 43 44 45 46 47 48 49 50 51 Subtyping (cross-reference PL/Type Systems) Subtype polymorphism; implicit upcasts in typed languages Notion of behavioral replacement: subtypes acting like supertypes Relationship between subtyping and inheritance Object-oriented idioms for encapsulation Privacy and visibility of class members Interfaces revealing only method signatures Abstract base classes Using collection classes, iterators, and other common library components 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 1. Compare and contrast (1) the procedural/functional approach defining a function for each operation with the function body providing a case for each data variant and (2) the object-oriented approach defining a class for each data variant with the class definition providing a method for each operation. Understand both as defining a matrix of operations and variants. [Assessment] This outcome also appears in PL/Functional Programming. 2. Use subclassing to design simple class hierarchies that allow code to be reused for distinct subclasses. [Usage] 3. Correctly reason about control flow in a program using dynamic dispatch. [Usage] 4. Explain the relationship between object-oriented inheritance (code-sharing and overriding) and subtyping (the idea of a subtype being usable in a context that expects the supertype). [Familiarity] 5. Use multiple encapsulation mechanisms, such as function closures, object-oriented interfaces, and support for abstract datatypes, in multiple programming languages. [Usage] This outcome also appears in PL/Functional Programming. - 134 -

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 6. Define and use iterators and other operations on aggregates, including operations that take functions as arguments, in multiple programming languages, selecting the most natural idioms for each language. [Usage] This outcome also appears in PL/Functional Programming. PL/Functional Programming [3 Core-Tier1 hours, 4 Core-Tier2 hours] Effect-free programming Function calls have no side effects, facilitating compositional reasoning Variables are immutable, preventing unexpected changes to program data by other code Data can be freely aliased or copied without introducing unintended effects from mutation Processing structured data (e.g., trees) via functions with cases for each data variant Associated language constructs such as discriminated unions and pattern-matching over them Functions defined over compound data in terms of functions applied to the constituent pieces First-class functions (taking, returning, and storing functions) Function closures (functions using variables in the enclosing lexical environment) Basic meaning and definition -- creating closures at run-time by capturing the environment Canonical idioms: call-backs, arguments to iterators, reusable code via function arguments Using a closure to encapsulate data in its environment Currying and partial application Defining higher-order operations on aggregates, especially map, reduce/fold, and filter 1. Compare and contrast (1) the procedural/functional approach defining a function for each operation with the function body providing a case for each data variant and (2) the object-oriented approach defining a class for each data variant with the class definition providing a method for each operation. Understand both as defining a matrix of operations and variants. [Assessment] This outcome also appears in PL/Object-Oriented Programming. 2. Write basic algorithms that avoid assigning to mutable state or considering reference equality. [Usage] 3. Write useful functions that take and return other functions. [Usage] 4. Correctly reason about variables and lexical scope in a program using function closures. [Usage] 5. Use multiple encapsulation mechanisms, such as function closures, object-oriented interfaces, and support for abstract datatypes, in multiple programming languages. [Usage] This outcome also appears in PL/Object-Oriented Programming. 6. Define and use iterators and other operations on aggregates, including operations that take functions as arguments, in multiple programming languages, selecting the most natural idioms for each language. [Usage] This outcome also appears in PL/Object-Oriented Programming. - 135 -

113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 PL/Event-Driven and Reactive Programming [2 Core-Tier2 hours] This material can stand alone or be integrated with other knowledge units on concurrency, asynchrony, and threading to allow contrasting events with threads. Events and event handlers Canonical uses such as GUIs, mobile devices, robots, servers Using a reactive framework Defining event handlers/listeners Main event loop not under event-handler-writer s control Externally-generated events and program-generated events Separation of model, view, and controller 1. Write event handlers for use in reactive systems, such as GUIs. [Usage] 2. Explain why an event-driven programming style is natural in domains where programs react to external events. [Familiarity] PL/Basic Type Systems [1 Core-Tier1 hour, 4 Core-Tier2 hours] The core-tier2 hours would be profitably spent both on the core-tier2 topics and on a less shallow treatment of the core-tier1 topics and learning outcomes. A type as a set of values together with a set of operations o Primitive types (e.g., numbers, Booleans) o Compound types built from other types (e.g., records, unions, arrays, lists, functions, references) Association of types to variables, arguments, results, and fields Type safety and errors caused by using values inconsistently with their intended types Goals and limitations of static typing o Eliminating some classes of errors without running the program o Undecidability means static analysis must conservatively approximate program behavior Generic types (parametric polymorphism) o Definition o Use for generic libraries such as collections o Comparison with ad hoc polymorphism (overloading) and subtype polymorphism Complementary benefits of static and dynamic typing o Errors early vs. errors late/avoided - 136 -

155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 o Enforce invariants during code development and code maintenance vs. postpone typing decisions while prototyping and conveniently allow flexible coding patterns such as heterogeneous collections o Avoid misuse of code vs. allow more code reuse o Detect incomplete programs vs. allow incomplete programs to run 1. For multiple programming languages, identify program properties checked statically and program properties checked dynamically. Use this knowledge when writing and debugging programs. [Usage] 2. Define and use program pieces (such as functions, classes, methods) that use generic types. [Usage] 3. Explain benefits and limitations of static typing. [Familiarity] PL/Program Representation [1 Core-Tier2 hour] Programs that take (other) programs as input such as interpreters, compilers, type-checkers, documentation generators, etc. Abstract syntax trees; contrast with concrete syntax Data structures to represent code for execution, translation, or transmission 1. Write a program to process some representation of code for some purpose, such as an interpreter, an expression optimizer, a documentation generator, etc. [Usage] PL/Language Translation and Execution [3 Core-Tier2 hours] 185 186 187 188 189 190 191 192 193 194 195 196 197 Interpretation vs. compilation to native code vs. compilation to portable intermediate representation Language translation pipeline: parsing, optional type-checking, translation, linking, execution o Execution as native code or within a virtual machine o Alternatives like dynamic loading and dynamic (or just-in-time ) code generation Run-time representation of core language constructs such as objects (method tables) and first-class functions (closures) Run-time layout of memory: call-stack, heap, static data o Implementing loops, recursion, and tail calls Memory management o Manual memory management: allocating, deallocating, and reusing heap memory o Automated memory management: garbage collection as an automated technique using the notion of reachability - 137 -

198 199 200 201 202 203 204 205 206 207 208 209 210 1. Distinguish syntax and parsing from semantics and evaluation. [Familiarity] 2. Distinguish a language definition (what constructs mean) from a particular language implementation (compiler vs. interpreter, run-time representation of data objects, etc.). [Familiarity] 3. Explain how programming language implementations typically organize memory into global data, text, heap, and stack sections and how features such as recursion and memory management map to this memory model. [Familiarity] 4. Reason about memory leaks, dangling-pointer dereferences, and the benefits and limitations of garbage collection. [Usage] PL/Syntax Analysis 211 212 213 214 215 Scanning (lexical analysis) using regular expressions Parsing strategies including top-down (e.g., recursive descent, Earley parsing, or LL) and bottom-up (e.g., backtracking or LR) techniques; role of context-free grammars Generating scanners and parsers from declarative specifications 216 217 218 219 220 221 222 223 1. Use formal grammars to specify the syntax of languages. [Usage] 2. Use declarative tools to generate parsers and scanners. [Usage] 3. Identify key issues in syntax definitions: ambiguity, associativity, precedence. [Familiarity] PL/Compiler Semantic Analysis 224 225 226 227 228 High-level program representations such as abstract syntax trees Scope and binding resolution Type checking Declarative specifications such as attribute grammars 229 230 231 232 1. Implement context-sensitive, source-level static analyses such as type-checkers or resolving identifiers to identify their binding occurrences. [Usage] 233-138 -

234 235 236 PL/Code Generation 237 238 239 240 241 242 243 Instruction selection Procedure calls and method dispatching Register allocation Separate compilation; linking Instruction scheduling Peephole optimization 244 245 246 247 248 249 250 251 252 253 1. Identify all essential steps for automatically converting source code into assembly or other low-level languages. [Familiarity] 2. Generate the low-level code for calling functions/methods in modern languages. [Usage] 3. Discuss opportunities for optimization introduced by naive translation and approaches for achieving optimization. [Familiarity] PL/Runtime Systems 254 255 256 257 258 259 260 Target-platform characteristics such as registers, instructions, bytecodes Dynamic memory management approaches and techniques: malloc/free, garbage collection (mark-sweep, copying, reference counting), regions (also known as arenas or zones) Data layout for objects and activation records Just-in-time compilation and dynamic recompilation Other features such as class loading, threads, security, etc. 261 262 263 264 265 266 267 1. Compare the benefits of different memory-management schemes, using concepts such as fragmentation, locality, and memory overhead. [Familiarity] 2. Discuss benefits and limitations of automatic memory management. [Familiarity] 3. Identify the services provided by modern language run-time systems. [Familiarity] 4. Discuss advantages, disadvantages, and difficulties of dynamic recompilation. [Familiarity] 268-139 -

269 270 271 PL/Static Analysis 272 273 274 275 276 277 278 279 280 281 Relevant program representations, such as basic blocks, control-flow graphs, def-use chains, static single assignment, etc. Undecidability and consequences for program analysis Flow-insensitive analyses, such as type-checking and scalable pointer and alias analyses Flow-sensitive analyses, such as forward and backward dataflow analyses Path-sensitive analyses, such as software model checking Tools and frameworks for defining analyses Role of static analysis in program optimization Role of static analysis in (partial) verification and bug-finding 282 283 284 285 286 287 288 289 290 291 292 1. Define useful static analyses in terms of a conceptual framework such as dataflow analysis. [Usage] 2. Communicate why an analysis is correct (sound and terminating). [Usage] 3. Explain why non-trivial sound static analyses must be approximate. [Familiarity] 4. Distinguish may and must analyses. [Familiarity] 5. Explain why potential aliasing limits sound program analysis and how alias analysis can help. [Familiarity] 6. Use the results of a static analysis for program optimization and/or partial program correctness. [Usage] PL/Advanced Programming Constructs 293 294 295 296 297 298 299 300 301 Lazy evaluation and infinite streams Control Abstractions: Exception Handling, Continuations, Monads Object-oriented abstractions: Multiple inheritance, Mixins, Traits, Multimethods Metaprogramming: Macros, Generative programming, Model-based development Module systems String manipulation via pattern-matching (regular expressions) Dynamic code evaluation ( eval ) Language support for checking assertions, invariants, and pre/post-conditions 302 303 304 305 306 307 308 1. Use various advanced programming constructs and idioms correctly. [Usage] 2. Discuss how various advanced programming constructs aim to improve program structure, software quality, and programmer productivity. [Familiarity] 3. Discuss how various advanced programming constructs interact with the definition and implementation of other language features. [Familiarity] 309-140 -

310 311 312 313 314 315 316 317 318 PL/Concurrency and Parallelism Support for concurrency is a fundamental programming-languages issue with rich material in programming language design, language implementation, and language theory. Due to coverage in other Knowledge Areas, this elective Knowledge Unit aims only to complement the material included elsewhere in the body of knowledge. Courses on programming languages are an excellent place to include a general treatment of concurrency including this other material. (Cross-reference: PD-Parallel and Distributed Computing) 319 320 321 322 323 324 325 Constructs for thread-shared variables and shared-memory synchronization Actor models Futures Language support for data parallelism Models for passing messages between sequential processes Effect of memory-consistency models on language semantics and correct code generation 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 1. Write correct concurrent programs using multiple programming models. [Usage] 2. Explain why programming languages do not guarantee sequential consistency in the presence of data races and what programmers must do as a result. [Familiarity] PL/Type Systems Compositional type constructors, such as product types (for aggregates), sum types (for unions), function types, quantified types, and recursive types Type checking Type safety as preservation plus progress Type inference Static overloading 1. Define a type system precisely and compositionally. [Usage] 2. For various foundational type constructors, identify the values they describe and the invariants they enforce. [Familiarity] 3. Precisely specify the invariants preserved by a sound type system. [Familiarity] 347-141 -

348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 PL/Formal Semantics Syntax vs. semantics Lambda Calculus Approaches to semantics: Operational, Denotational, Axiomatic Proofs by induction over language semantics Formal definitions and proofs for type systems Parametricity 1. Give a formal semantics for a small language. [Usage] 2. Use induction to prove properties of all (or a well-defined subset of) programs in a language. [Usage] 3. Use language-based techniques to build a formal model of a software system. [Usage] PL/Language Pragmatics Principles of language design such as orthogonality Evaluation order, precedence, and associativity Eager vs. delayed evaluation Defining control and iteration constructs External calls and system libraries 1. Discuss the role of concepts such as orthogonality and well-chosen defaults in language design. [Familiarity] 2. Use crisp and objective criteria for evaluating language-design decisions. [Usage] PL/Logic Programming Clausal representation of data structures and algorithms Unification Backtracking and search 1. Use a logic language to implement conventional algorithms. [Usage] 2. Use a logic language to implement algorithms employing implicit search using clauses and relations. [Usage] - 142 -