SlideShare a Scribd company logo
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
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

More Related Content

PPT
Lex and Yacc ppt
PPTX
Lexical analyzer generator lex
PPTX
Lex Tool
PPTX
Presentation on C++ programming
PDF
C programming Ms. Pranoti Doke
PPTX
BUILDING BASIC STRECH SQL COMPILER
PPTX
Lex & yacc
Lex and Yacc ppt
Lexical analyzer generator lex
Lex Tool
Presentation on C++ programming
C programming Ms. Pranoti Doke
BUILDING BASIC STRECH SQL COMPILER
Lex & yacc

What's hot (20)

PPTX
C101 – Intro to Programming with C
PPT
Lexyacc
PDF
Lexical
DOC
Lex tool manual
PPTX
PDF
Lecture4 lexical analysis2
PPTX
Intermediate code- generation
PPT
Symbol Table, Error Handler & Code Generation
PDF
Lexyacc
PDF
system software 16 marks
PPTX
C++ Basics
PDF
Assembly language part I
PPTX
PPTX
System Programming Unit IV
PPT
Interm codegen
PPTX
Three address code In Compiler Design
PPTX
First pass of assembler
PPT
Lecture 16 17 code-generation
PPT
Chapter Three(1)
C101 – Intro to Programming with C
Lexyacc
Lexical
Lex tool manual
Lecture4 lexical analysis2
Intermediate code- generation
Symbol Table, Error Handler & Code Generation
Lexyacc
system software 16 marks
C++ Basics
Assembly language part I
System Programming Unit IV
Interm codegen
Three address code In Compiler Design
First pass of assembler
Lecture 16 17 code-generation
Chapter Three(1)
Ad

Viewers also liked (8)

PPTX
Social Graphs and Semantic Analytics
PDF
WatITis2013: Why API? (cpbell)
PDF
Do More with Less: Semantic Technologies
PPTX
FINAL-PDAG-May2016--IST-EA-Update
PPTX
ITANA 2016: API Architecture and Implementation
PDF
WatITis2012: The Service Oriented Enterprise (SOE) [cpbell]
PDF
Progress IST-EA: Role, Responsibilities, and Activities
PDF
OUCC2015 Service Oriented Enterprise (SOE)
Social Graphs and Semantic Analytics
WatITis2013: Why API? (cpbell)
Do More with Less: Semantic Technologies
FINAL-PDAG-May2016--IST-EA-Update
ITANA 2016: API Architecture and Implementation
WatITis2012: The Service Oriented Enterprise (SOE) [cpbell]
Progress IST-EA: Role, Responsibilities, and Activities
OUCC2015 Service Oriented Enterprise (SOE)
Ad

Similar to cs241-f06-final-overview (20)

PPT
Cpcs302 1
PDF
sysprog1
PPT
A-overview.pptbb cpp introduction how cpp
PDF
Cimplementation
PDF
Compilers Design
PPT
CC Week 11.ppt
DOCX
System programmin practical file
PPT
Compiler Construction Chapter number 1 slide
PDF
Cd lab manual
PPTX
Intro to Forth - 2018/09/13 ACM Greenville
PPTX
Lecture 04 Programming C for Beginners 001
PPT
Chapter1 Introduction of compiler
PDF
Btech IT Sem VII and VIII-1 (1).pdf
PPT
01.ppt
PPT
Ch1 (1).ppt
PDF
compiler design BCS613C question bank 2022 scheme
PPTX
Cs419 Compiler lec1&2 introduction
PPT
C program compiler presentation
PDF
Writing a C Compiler Build a Real Programming Language from Scratch Nora Sandler
PDF
Syntax Analysis.pdf
Cpcs302 1
sysprog1
A-overview.pptbb cpp introduction how cpp
Cimplementation
Compilers Design
CC Week 11.ppt
System programmin practical file
Compiler Construction Chapter number 1 slide
Cd lab manual
Intro to Forth - 2018/09/13 ACM Greenville
Lecture 04 Programming C for Beginners 001
Chapter1 Introduction of compiler
Btech IT Sem VII and VIII-1 (1).pdf
01.ppt
Ch1 (1).ppt
compiler design BCS613C question bank 2022 scheme
Cs419 Compiler lec1&2 introduction
C program compiler presentation
Writing a C Compiler Build a Real Programming Language from Scratch Nora Sandler
Syntax Analysis.pdf

cs241-f06-final-overview

  • 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