Presentation is loading. Please wait.

Presentation is loading. Please wait.

0 Abstract Syntax Tree (AST) Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Each leaf represents an operand and each non leaf an operator.

Similar presentations


Presentation on theme: "0 Abstract Syntax Tree (AST) Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Each leaf represents an operand and each non leaf an operator."— Presentation transcript:

1 0 Abstract Syntax Tree (AST) Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Each leaf represents an operand and each non leaf an operator 2*32*(3+4)2*3+4

2 1 Evaluation: Depth First Traverse of an AST 2*32*(3+4)2*3+4

3 2 Evaluation: Stack Execution Diagrams 2*3 Stack Execution Diagrams: AST traversal:

4 3 Evaluation: Stack Execution Diagrams 2*(3+4)2*3+4

5 4 Extended AST and Extended SED Extended Abstract Syntax Tree int f(int n) {return 2*n;} Extended Stack Execution Diagrams A node can also be a function int g(int n) {return 3*n;}

6 5 Extended AST and Extended SED f(4+5)

7 6 Extended AST f(g(5))f(4)+g(5)


Download ppt "0 Abstract Syntax Tree (AST) Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Each leaf represents an operand and each non leaf an operator."

Similar presentations


Ads by Google