Final Exam Topics • Introduction – Programming languages classification.

advertisement
Final Exam Topics
• Introduction
– Programming languages classification.
– What makes a successful programming language?
– Declarative languages (definition)
∗ Functional programming languages
∗ Logical programming languages
– Imperative languages (definition)
∗ Procedural and object-oriented languages.
– Compilation and interpretation
∗ Definition
∗ What is the main difference between compilation and interpretation?
– Compiler phases and what each phase does.
• Syntax
– Lexical analysis.
– Tokens and regular expressions.
– Regular expressions and NFA.
– Syntax analysis.
– Formal definition of grammar
– Leftmost and rightmost derivation
– Parse tree
– Ambiguous grammar
– Parsing – general understanding of approaches.
∗ Recursive descent parsing
∗ LL(1) Predictive parsing
• Semantic Analysis
– Static semantics and dynamic semantics.
– Attribute grammars – definition.
1
– Writing attribute grammars
∗ Adding semantic rules on a given grammar to perform some
function.
∗ Writing an attribute grammar to enhance the underlying context free grammar.
– Building a decorated parse tree (parse tree annotated with attributes).
– Synthesized and inherited attributes.
– S-attributed and L-attributed grammars
• Names, Scopes, and Bindings
– Name and binding.
– Potential binding time.
– Object lifetime and binding lifetime.
– Deactivation/reactivation of bindings.
– Object storage management schemes.
– The memory layout of a process/program.
– Static allocation
∗ Example of objects with static allocation.
∗ Can static allocation be used for local variables?
– Subroutine frame/activation record format.
– Stack allocation.
– Heap allocation
∗ Internal and external fragmentation.
∗ Block selection: first fit/best fit
∗ Garbage collection, what does it do?
– Scope definition.
– Dynamic scoping and static scoping.
– Static and dynamic chains.
• Expression and assignment.
– Infix, prefix, postfix, Cambridge Polish notations.
2
– Operator Precedence and Associativity (definition).
– Evaluation order of expressions.
∗ Why this is not specified by precedence and associativity?
∗ Why it is important?
∗ Design choices for different languages.
– Short circuit evaluation for boolean expressions.
– L-values and R-values.
– Value model and reference model for assignments.
• Structured and Unstructured Control Flow
– The concepts of structured and unstructured control flow.
– Goto’s.
– Sequencing.
– Selection and different forms of selection.
– Iteration and iterators.
∗ Enumeration-controlled loops.
∗ Logically-controlled loops.
· pretest
· posttest
· midtest
– Recursion.
– Tail-recursive functions and their optimization.
• Subroutines and Parameter Passing
– Subroutine frame (activation record) format.
– Stack layout for dynamic and static binding languagues.
– Calling sequences.
– Prologue and Epilogue.
– Issues with saving and restoring registers.
– Describe a typical calling sequence.
– Hardware/software support for efficient subroutine execution.
∗ Register windows.
3
∗ Inline functions.
– Parameter passing.
∗ Call-by-value.
∗ Call-by-reference.
∗ Call-by-sharing.
∗ Call-by-result, call-by-value/result.
∗ Call-by-name.
∗ Need to be able to apply these in programs.
• Functional Programming
– What is functional programming?
– Pros and cons of functional programming.
– Computation model for Scheme(Lisp): Lambda Calculus.
– Read-Eval-Print loop.
– Cambridge Polish notation.
– List manipulation functions.
– “if” special form.
– “cond” special form.
– Logical expressions.
– Lambda abstractions.
– Defining global names.
– Define local names.
– Define local names with self references.
– Scheme IO.
– Blocks.
– Higher-order functions.
– Non-pure constructs.
– Scheme programming: need to be able to write scheme functions
to achieve some simple tasks like those in the lectures.
• Logic Programming
4
– Need to know the background of logic programming and programming in Prolog.
– Horn clauses for rules and facts.
– Logical resolution strategies.
– Prolog terms and built-in predicates to manipulate terms.
– Variables and unification.
– Prolog list and list manipulation
– Prolog IO
– Arithmetic
– control features
– Meta-logic
– Prolog programming: need to be able to write prolog programs to
achieve some simple tasks like those in the lectures.
5
Download