CSC 533: Organization of Programming Languages
Spring 2007

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., JavaScript) 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 expressions & control structures sub-expression evaluation order, compound statements, loops & branching 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 Java vs. C++ vs. JavaScript C++ design goals: support OO, retain C performance, gentle path to OO C++ language features: added OO to C + numerous reliability features execution model: compiled, separate compilation for non-templated classes data: int, double, char, array, string, vector, ... control: if, switch, while, do, for, goto, ... modularity: structs & classes, stand-alone functions, templates pass-by-reference, static scoping memory management: stack-dynamic by default, can specify heap-dynamic no automatic garbage collection, destructors; strongly typed Java design goals: simple, OO, robust, architecture neutral, portable, ... Java language features: emphasize ease of programming more than efficiency based on C++ syntax, but removed many confusing/redundant features execution model: compile into byte code, then interpret with JVM data: int, double, char, array, String, ArrayList, LinkedList, TreeMap, ... control: if, switch, while, do, for, ... modularity: classes, dynamic (late) binding, generics pass-by-value, static scoping memory management: stack-dynamic primitives, heap-dynamic objects automatic garbage collection; strongly typed JavaScript design goals: small, quick & dirty programming, user security JavaScript language features: designed for controlling HTML elements execution model: embedded in HTML document, interpreted by browser plugin data: number, string, array, document, ... control: if, switch, while, do, for, ... modularity: functions, predefined objects, primitive classes & inheritance pass-by-value, scope limited to functions vs. global memory management: stack-dynamic primitives, heap-dynamic objects supposed to do automatic garbage collection, depends upon the browser weakly typed; types associated with values, not variables 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)