dis4 - CMPSC 160 Translation of Programming Languages...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPSC 160 Translation of Programming Languages Project 3: Abstract Syntax Tree
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Small note: Project 2 is yet to be graded Hoping to get it done by Tuesday
Background image of page 2
Plan for today Kick off the 3 rd project Lexer Parser Proj 2 Proj 3 Abstract Syntax Tree Type Checking Proj 4 Code Generation Proj 5
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Warning about the 3 rd project You'll be given a lot of pre-made code It's up to YOU to understand it, take the time Top-down approach
Background image of page 4
Project 3 guide Introduction to ASTs AST Components AST Component Relations & Construction
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Project 3 guide Introduction to ASTs AST Components AST Component Relations & Construction
Background image of page 6
Sample Simple Program integer function f1(integer arg1; boolean arg2) { integer var number; number = sqrt(arg1 + arg2); return number; }
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A close look at an AST
Background image of page 8
Why AST? Program Analysis Type Checking Verification Optimizations Concise and mutable
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Project 3 guide Introduction to ASTs AST Components AST Component Relations & Construction
Background image of page 10
AST Component Description From the bundled file 'ast.cdef' Program ==> *Func Func ==> Type SymName *Decl Function_block Function_block ==> *Decl *Func *Stat Nested_block ==> *Stat Decl ==> Type *SymName Stat:Assignment ==> SymName Expr Stat:ArrayAssignment ==> SymName Expr Expr Stat:Call ==> SymName SymName *Expr Stat:ArrayCall ==> SymName Expr SymName *Expr Stat:IfNoElse ==> Expr Nested_block Stat:IfWithElse ==> Expr Nested_block Nested_block Stat:ForLoop ==> Stat Expr Stat Nested_block Stat:Return ==> Expr Stat:None ==> ...
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The ast.cdef file
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

dis4 - CMPSC 160 Translation of Programming Languages...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online