matlab objects using nested functions mathworks compiler course – day 2
Post on 22-Dec-2015
242 views
TRANSCRIPT
![Page 1: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/1.jpg)
• MATLAB objects using nested functions
MathWorks Compiler Course – Day 2
![Page 2: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/2.jpg)
• MATLAB objects using nested functions
• The structure of xcom
MathWorks Compiler Course – Day 2
![Page 3: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/3.jpg)
• The structure of xcom
MathWorks Compiler Course – Day 2
Analysis
Synthesis
Runtime
IR – syntax tree + symbols
EXE – link&go
results
XX.cfg
![Page 4: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/4.jpg)
• The structure of Analysis
MathWorks Compiler Course – Day 2
Cfg
Lexer
Parser
Tree
Symbols
X.cfg
Cfg tables
lexemes
shift/reduce sequence
syntax tree
symbol table
X
![Page 5: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/5.jpg)
• The structure of Cfg
MathWorks Compiler Course – Day 2
X.cfg
VN VI Π
heads
rule names, lengths
Cfg
cfg.mat
reserved words, ops
reserved words, ops
![Page 6: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/6.jpg)
• Notation supporting grammars
MathWorks Compiler Course – Day 2
![Page 7: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/7.jpg)
• Notation supporting grammars– Definitions
MathWorks Compiler Course – Day 2
![Page 8: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/8.jpg)
• Notation supporting grammars– Definitions– Greek alphabet
MathWorks Compiler Course – Day 2
![Page 9: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/9.jpg)
• Notation supporting grammars– Definitions– Greek alphabet– Propositional and Predicate Logic
MathWorks Compiler Course – Day 2
![Page 10: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/10.jpg)
• Notation supporting grammars– Definitions– Greek alphabet– Propositional and Predicate Logic– Sets
MathWorks Compiler Course – Day 2
![Page 11: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/11.jpg)
• Notation supporting grammars– Definitions– Greek alphabet– Propositional and Predicate Logic– Sets– Ordered pairs and tuples
MathWorks Compiler Course – Day 2
![Page 12: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/12.jpg)
• Notation supporting grammars– Definitions– Greek alphabet– Propositional and Predicate Logic– Sets– Ordered pairs and tuples– Sequences
MathWorks Compiler Course – Day 2
![Page 13: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/13.jpg)
• Notation supporting grammars– Definitions– Greek alphabet– Propositional and Predicate Logic– Sets– Ordered pairs and tuples– Sequences– Relations
MathWorks Compiler Course – Day 2
![Page 14: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/14.jpg)
• Notation supporting grammars
• Context-free Grammars
MathWorks Compiler Course – Day 2
![Page 15: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/15.jpg)
• Notation supporting grammars
• Context-free Grammars– Phrase structure
MathWorks Compiler Course – Day 2
![Page 16: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/16.jpg)
• Notation supporting grammars
• Context-free Grammars– Phrase structure– Reduction rules
MathWorks Compiler Course – Day 2
![Page 17: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/17.jpg)
• Notation supporting grammars
• Context-free Grammars– Phrase structure– Reduction rules– Doing reductions
MathWorks Compiler Course – Day 2
![Page 18: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/18.jpg)
• Notation supporting grammars
• Context-free Grammars– Phrase structure– Reduction rules– Doing reductions– Syntax tree
MathWorks Compiler Course – Day 2
![Page 19: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/19.jpg)
• Notation supporting grammars
• Context-free Grammars– Phrase structure– Reduction rules– Doing reductions– Syntax tree– Everyday notation for CFGs
MathWorks Compiler Course – Day 2
![Page 20: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/20.jpg)
• Notation supporting grammars
• Context-free Grammars– Reduction rules– Doing reductions– Syntax tree– Everyday notation for CFGs– Rule names, numbers
MathWorks Compiler Course – Day 2
![Page 21: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/21.jpg)
• Notation supporting grammars
• Context-free Grammars– Doing reductions– Syntax tree– Everyday notation for CFGs– Rule names, numbers– Formal definition of CFG
MathWorks Compiler Course – Day 2
![Page 22: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/22.jpg)
• Notation supporting grammars
• Context-free Grammars– Doing reductions– Syntax tree– Everyday notation for CFGs– Rule names, numbers– Formal definition of CFG– Derive CFG from Π alone
MathWorks Compiler Course – Day 2
![Page 23: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/23.jpg)
• Notation supporting grammars
• Context-free Grammars– Syntax tree– Everyday notation for CFGs– Rule names, numbers– Formal definition of CFG– Derive CFG from Π alone– Formal definition of language
MathWorks Compiler Course – Day 2
![Page 24: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/24.jpg)
• Notation supporting grammars
• Context-free Grammars– Everyday notation for CFGs– Rule names, numbers– Formal definition of CFG– Derive CFG from Π alone– Formal definition of language– Left to right parsing
MathWorks Compiler Course – Day 2
![Page 25: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/25.jpg)
• Notation supporting grammars
• Context-free Grammars– Rule names, numbers– Formal definition of CFG– Derive CFG from Π alone– Formal definition of language– Left to right parsing– Restrictions on CFGs
MathWorks Compiler Course – Day 2
![Page 26: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/26.jpg)
• Notation supporting grammars
• Context-free Grammars– Formal definition of CFG– Derive CFG from Π alone– Formal definition of language– Left to right parsing– Restrictions on CFGs– Transforming CFGs
MathWorks Compiler Course – Day 2
![Page 27: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/27.jpg)
• Notation supporting grammars
• Context-free Grammars– Derive CFG from Π alone– Formal definition of language– Left to right parsing– Restrictions on CFGs– Transforming CFGs– Free-form CFGs
MathWorks Compiler Course – Day 2
![Page 28: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/28.jpg)
• Notation supporting grammars
• Context-free Grammars– Formal definition of language– Left to right parsing– Restrictions on CFGs– Transforming CFGs– Free-form CFGs– A grammar-grammar
MathWorks Compiler Course – Day 2
![Page 29: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/29.jpg)
• Notation supporting grammars
• Context-free Grammars
• Regular Expressions
MathWorks Compiler Course – Day 2
![Page 30: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/30.jpg)
• Notation supporting grammars
• Context-free Grammars
• Regular Expressions
• Finite Automata
MathWorks Compiler Course – Day 2
![Page 31: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/31.jpg)
• Notation supporting grammars
• Context-free Grammars
• Regular Expressions
• Finite Automata– State-transition diagrams
MathWorks Compiler Course – Day 2
![Page 32: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/32.jpg)
• Notation supporting grammars
• Context-free Grammars
• Regular Expressions
• Finite Automata (FA)– State-transition diagrams– CFG for FA
MathWorks Compiler Course – Day 2
![Page 33: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/33.jpg)
• Notation supporting grammars
• Context-free Grammars
• Regular Expressions
• Finite Automata (FA)– State-transition diagrams– CFG for FA
• Deterministic (DFA)
MathWorks Compiler Course – Day 2
![Page 34: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/34.jpg)
• Notation supporting grammars
• Context-free Grammars
• Regular Expressions
• Finite Automata (FA)– State-transition diagrams– CFG for FA
• Deterministic (DFA)• Nondeterministic (NFA)
MathWorks Compiler Course – Day 2
![Page 35: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/35.jpg)
• Context-free Grammars
• Regular Expressions
• Finite Automata (FA)– State-transition diagrams– CFG for FA
• Deterministic (DFA)• Nondeterministic (NFA)
– NFA to DFA
MathWorks Compiler Course – Day 2
![Page 36: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/36.jpg)
• Regular Expressions
• Finite Automata (FA)– State-transition diagrams– CFG for FA
• Deterministic (DFA)• Nondeterministic (NFA)
– NFA to DFA
• Regular Expression Grammars (REG)
MathWorks Compiler Course – Day 2
![Page 37: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/37.jpg)
• Finite Automata (FA)– State-transition diagrams– CFG for FA
• Deterministic (DFA)• Nondeterministic (NFA)
– NFA to DFA
• Regular Expression Grammars (REG)– REG grammar-grammar
MathWorks Compiler Course – Day 2
![Page 38: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/38.jpg)
• Finite Automata (FA)
• Regular Expression Grammars (REG)– REG grammar-grammar– Rewriting REGs
MathWorks Compiler Course – Day 2
![Page 39: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/39.jpg)
• Finite Automata (FA)
• Regular Expression Grammars (REG)– REG grammar-grammar– Rewriting REGs
• I/O Grammars (IOG)
MathWorks Compiler Course – Day 2
![Page 40: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/40.jpg)
• Finite Automata (FA)
• Regular Expression Grammars (REG)– REG grammar-grammar– Rewriting REGs
• I/O Grammars (IOG)– Formal Definition of IOG
MathWorks Compiler Course – Day 2
![Page 41: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/41.jpg)
• Regular Expression Grammars (REG)– REG grammar-grammar– Rewriting REGs
• I/O Grammars (IOG)– Formal Definition of IOG– IOG grammar-grammar
MathWorks Compiler Course – Day 2
![Page 42: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/42.jpg)
• Regular Expression Grammars (REG)– REG grammar-grammar– Rewriting REGs
• I/O Grammars (IOG)– Formal Definition of IOG– IOG grammar-grammar– Rewriting IOGs
MathWorks Compiler Course – Day 2
![Page 43: MATLAB objects using nested functions MathWorks Compiler Course – Day 2](https://reader036.vdocuments.site/reader036/viewer/2022062320/56649d7b5503460f94a5f5c4/html5/thumbnails/43.jpg)
• Regular Expression Grammars (REG)– REG grammar-grammar– Rewriting REGs
• I/O Grammars (IOG)– Formal Definition of IOG– IOG grammar-grammar– Rewriting IOGs
• Grammars for X, C and Java
MathWorks Compiler Course – Day 2