CS 331 Spring 2013
> Lecture Notes for Monday, May 6, 2013
CS 331 Spring 2013
Lecture Notes for Monday, May 6, 2013
General Review
Here is the outline of the topics covered this semester.
Syntax & Semantics
Intro
Static, dynamic
Syntax, semantics
Languages & Grammars
(Formal) language, alphabet, notation
Generator, recognizer
(Phrase-structure) grammar
Terminal, nonterminal
Production (rule)
Derivation
Regular grammar & language
Finite automaton
State, transition, start state, accepting states, accept input, recognize language
Regular expression, match, Kleene star
CFG & CFL
Parse tree (Abstract Syntax Tree = AST)
Ambiguity, inherent ambiguity
Leftmost & rightmost derivation
BNF, EBNF, grammars in practice
Lexing & Parsing
Parsing: lexical analysis (lexing), syntax analysis (parsing)
Token, lexeme, keyword, reserved word
Writing a state machine
Lookahead
Top-down & bottom-up parsers
LL, LR
Recursive-descent parsing
Left recursion
Left-factord production
Shift-reduce parsing
Action table, goto table, shift op, reduce op
LL(k), LR(k) [diff grammars, not diff langs]
LALR
Fastest known algorithms for all CFL: \(O(n^3)\)
Algorithms used: \(O(n)\)
Specifying Semantics
Static & Dynamic Semantics
Attribute grammar
Operational Semantics
Axiomatic Semantics
Denotational Semantics
Survey of Programming Languages
The Programming Languages
Haskell
Python
Scheme
Forth
Prolog
Ways to compare Programming Languages
Syntax issues
Build/Exec Process
Values & Typing
Flow of Control (including error handling)
I/O
Miscellaneous Programming-Language Concepts
Side effect
Functional programming, functional programming language, pure functional language
First-class (function)
Mutable data
Higher-order function
lazy & strict/eager evaluation
REPL
Expression
Pattern matching (in Haskell, Prolog)
Haskell type class
Currying
Lambda expression/function
primitive operation
cons
(List) comprehension [and other kinds]
Haskell guards
Doing iteration without mutable data
TCO
Map, filter, fold/reduce
Haskell I/O action, do block
Scripting langugage, dynamic language
imperative language
#! convention
Python generator
Properties of Lisp family
Scheme data
Cons cell, car & cdr
Scheme function call
Scheme macros
Concatenative language
Stack-based language
Forth stack notation
Forth word
Forth dictionary
Forth parameter & return-value passing
Logic programming
Predicate
Prolog goal, success/failure
Prolog cut
Prolog iteration
Typing
static/dynamic, tags
Typing of variables vs. values
Explicit/implicit
Strong/weak, sound
Duck typing
Scope & lifetime
Scope
Lexical/static scope
Dynamic scope
Lifetime
Reference counting
Garbage collection
CS 331 Spring 2013: Lecture Notes for Monday, May 6, 2013 / Updated: 8 Mar 2013 /
Glenn G. Chappell
/
ggchappell@alaska.edu