1. DEC
Lexical Analysis
(Recognizing & Scanning)
WL
MIPS
Context-Free / Syntactic
Analysis
(Parsing)
Context-Sensitive / Semantic
Analysis
Code Generation
- Given a chunk of WL code:
> perform semantic analysis on it
- Discuss how you performed semantic analysis of WL Programs
> build a table:
* verify (1) it is not already in the table (definition)
* verify (2) variables being used are in the table (usage)
- Generate Code:
> Given a WL parse tree/code, generate equivalent MIPS code.
- Strategies:
> how did you implement your chosen strategy?
> provide sketch of algorithm to convert WL to MIPS
- Reading/Understanding MIPS, MERL, Conversion Reference
- Interpreting Bits (work with all interpretations, base conversion)
- Write Assembly Language Programs
> control structures (loops, conditionals), array addressing
> memory-mapped i/o, functions (recursive and non-recursive)
> allocating memory (directives, stack)
- Linking and Loading (MERL, .import, .export)
- Write WL programs to solve given problems.
- Explain what given WL programs do.
- Parse WL programs (would given code compile?)
- DFAs, NFAs, NFAs with Epsilon Transitions
> draw DFAs for accepting a given language (set of strings)
> decide if a given string is accepted by a given *FA
- Regular Expressions
> given a language, provide a regular expression to match it
> given a regular expression, decide if a string is accepted
- Write pseudocode for any algorithms dealing with RLs
> accepting w/ DFAs, NFAs, NFAs w/ epsilons, Maximal-Munch
- CFGs: (understand assignment CFG file format reference)
> given a CFG, give derivations for given strings.
> given a CFG, find an ambiguous derivation.
- Parsing:
> LL(1): given predict table, parse a string.
> LR(1): given shift/reduce rules or LR(1) DFA, parse a string.
- Parse Tree Play:
> understand how to draw a tree for a derivation
- Stored Program Computer (CPU, RAM, Machine-Cycle)
- Abstractions (Machine -> Assembly -> High-Level Language)
- Bit-Interpretations ("Meaning is in the eye of the beholder.")
> bit, nibble (4 bits), byte (8 bits), word (32 bits)
> two's complement, unsigned, instruction interpretations
- Memory Usage @ Run-Time (code+data, stack, addresses)
- Assembler Function and Construction
- Understand How/Why: Traversal of Parse Trees.
- Understand Strategies for Generating Code:
> why do we want a strategy? Ad-Hoc vs. Strategic methods.
> how did the strategies presented in class work?
* (Lhotak/Pretti) vars in C+D section, (Cormack) unique offsets
- Why have prologue/epilogue sections in generated code?
- Briefly, what does it mean to optimize your generated code?
> not how, know that you can streamline the generated code
- Define: Semantic/Context-Sensitive Analysis
- Understand the Semantic Requirements of the WL Language
> variables must be defined only once
> variables must be defined to be used
- Understand that Semantic Analysis verifies a string's 'meaning'.
- Define: Parsing, Context-Free Grammar/Language
- Context-Free Grammars:
> productions, derivations, membership in lang. def. by a CFG
> derivation/parse trees, ambiguity
- Parsing Algorithms
> top-down: LL(k) - first & follow sets, predict table
> bottom-up: LR(k) - shift/reduce rules. LR(1) machines (DFA)
- Left and Right Canonical Derivations
- Define: Scanner, Recognizer, Membership in Language, Tokens
- Regular Languages and Associated Tools (automata, regexp)
> DFAs, NFAs, NFAs w/ epsilon transitions, Regular Expressions
> DFAs with actions, transducers
- Properties of Regular Languages
- Compare and Contrast RLs with Context-Free Languages
- Algorithms Associated with DFAs, NFAs (w/eps and w/out eps)
- Scanning and Processing Strings with Maximal-Munch
- Understand WL Grammar:
> what is allowed? what is not?
* could you explain using the grammar (show derivation)?
- Understand Basic WL Parse Tree:
> convert WL code to and from parse trees
- WL Relation to Java/C++ (subset).
- WLPP vs. WL
Theory Practical
1
2
3
4
5
SEPT
C/C++
6
UW CS241 - F06
2. If you used it for the assignments you might need to know about it:
* COMPILE JAVA: javac filename.java (produces .class files)
* RUN JAVA: java ClassName <inputfile (runs main() method, System.in sees inputfile's contents)
* CAN REDIRECT INPUT AND OUTPUT USING: cmdname <inputfile and cmdname >outputfile
* BASIC UNIX CMDS:
ls (list files), cd dirname (change directory), mkdir dirname (make a directory)
man programname (get help on a program called programname), xxd filename (hexdump filename)
dos2unix (converts Windows rn endline sequences to Unix n newline sequences)
* EDITING IN CSCF ENVIRONMENT:
pico, vi/vim, emacs (text editors allow you to edit files)
* COMPILING C++ IN CSCF ENVIRONMENT: g++ -o exename filename0.cc filename1.cc ...
* EXECUTING COMPILED C++ CODE: ./exename (or, if no -o option given to g++) ./a.out
If you needed to do it on A10, you might need to do it on the exam:
- Compare C++ to Java. Compare C++ and WLPP.
- What are pointers? How do you de-reference a pointer (*p)? How can you get the address of a variable (&v)?
- How do you write a basic C++ program? int main() { ... }
- What are includes? What must you include to use printf(...)? How do you use printf(...)? How can you use the 'NULL' symbol?
- How do you create a struct? How does struct compare to class?
- What is operator overloading? How can you overload the '+' operator (for example)?
- pointer addition vs. [] syntactic sugar.
- 'new' keyword. 'delete' keyword. What do they do, why must we use them both in C++ but not in Java (delete doesn't exist in Java)?
- What are '.h' files and what are '.cc' files? What are function prototypes?
C/C++
UNIX
Other Materials You Might Need