CSC 533: Organization of Programming Languages
Spring 2012

Final Exam Review

Programming Paradigms procedural/imperative programming (e.g., C) basic concept: machine state (memory cells/variables) program by specifying a sequence of statements that alter the state object-based programming (e.g., C++, scripting languages) basic concept: abstract data types program by specifying complex types that interact via message passing object-oriented programming (e.g., C++, Java) basic concept: abstract data types + inheritance + dynamic (late) binding program by defining hierarchies of interacting objects functional programming (e.g., LISP/Scheme) basic concept: functional transformation program by defining and applying transformations to data General Language Issues language evaluation criteria: readability, writability, reliability, ... syntax & semantics BNF grammar, parse trees, ambiguity, EBNF, precedence & associativity operational, axiomatic, & denotational semantics variables & binding variable attributes, type/address/value binding, scope & lifetime static vs. dynamic binding, stack-based memory management, activation records data types primitive types: integer, floating-point, boolean, character, ... pointer: indirect addressing, dynamic memory management heap fragmentation & compaction, garbage collection vs. reference counts complex types: string, enumeration, subrange, array/vector, record/struct subprograms parameters: by-value, by-result, by-value-result, by-reference, by-name overloading functions/operators, templates abstract data types - requires encapsulation + info hiding C++ & Java classes, public vs. private vs. protected object-oriented programming - requires inheritance + dynamic (late) binding inheritance, overriding/overloading methods, public vs. protected fields polymorphism, IS_A relationship in Java: extends, super, abstract class, interface, no multiple inheritance in C++: ':', '::', virtual, abstract class, multiple inheritance C -> C++ -> Java -> scripting languages C design goals: high-level abstractions, support for systems programming C language features: high-level functions & control, but low-level access pass-by-value, arrays & structs, pointers,preprocessor directives memory management: stack-dynamic by default, malloc & free C++ design goals: support OO, retain C performance, gentle path to OO C++ language features: added OO to C + numerous reliability features pass-by-value and -reference, constants, new & delete, bool, string memory management: stack-dynamic by default, new & delete, copy constr. separate compilation, templated classes & functions Java design goals: simple, OO, network savvy, robust, secure, interpreted, portable, architecture neutral, high-performance, multi-threaded, dynamic Java language features: based on C++ but simpler & more secure pass-by-value only, Boolean, String library, name resolution at link time memory management: stack-dynamic primitives, heap-dynamic objects automatic garbage collection provided execution model: compile into byte code, then interpret with JVM Scripting languages: JavaScript, Dart, Perl, Python, Ruby, Lua LISP/Scheme design goals: simple & orthogonal, symbolic, dynamic lists, transparent memory language features: data & code are all S-expressions (atoms + lists) execution model: interpreted control: if, cond, recursion (w/ tail-recursion optimization), ... modularity: functions, can implement OO using first-class functions many useful primitive functions, can easily compose into new functions pass-by-value (with structure sharing), static scoping memory management: heap-dynamic, utilizes structure sharing automatic garbage collection weakly typed; types associated with values, not variables structuring data association list w/ assoc, trees via nested lists non-functional features I/O (display, newline, read, ...), sequencing (begin), destructive assignment (define, set!), environment definition (let) OOP via first-class functions