Presentation is loading. Please wait.

Presentation is loading. Please wait.

C H A P T E R T W O Syntax.

Similar presentations


Presentation on theme: "C H A P T E R T W O Syntax."— Presentation transcript:

1 C H A P T E R T W O Syntax

2 Parse Tree for 352 As an Integer
Figure 2.1

3 A Program Fragment Viewed As a Stream of Tokens
Figure 2.2

4 A Simple Lexical Syntax for a Small Language, Jay
Figure 2.3

5 Major Stages in the Compiling Process
Figure 2.4

6 Skeleton Lexical Analysis Method That Returns Tokens
Figure 2.5

7 Conventions for Writing Regular Expressions
Figure 2.6

8 A Concrete Syntax for Assignments and Expressions
Figure 2.7

9 Parse Tree for the Expression x+2*y
Figure 2.8

10 Sketch of a Parse Tree for a Complete Program
Figure 2.9

11 Two Different Parse Trees for the AmbExp 2 – 3 – 4
Figure 2.10

12 An Ambiguous If Statement
Figure 2.11

13 The “Dangling Else” Grammatical Ambiguity
Figure 2.12

14 EBNF-Based Parse Tree for the Expression x+2*y
Figure 2.13

15 Syntax Diagram for Expressions with Addition
Figure 2.14

16 Abstract Syntax for Expression, Assignment, and Loop
Figure 2.15

17 (a) Structure of a Binary Node
(a) Structure of a Binary Node. (b) Abstract Syntax Tree for the Expression x+2*y Figure 2.16

18 Partially Completed Recursive Descent Parse for Assignments
Figure 2.17

19 Algorithm for Writing a Recursive Parser from EBNF
Figure 2.18

20 An Example Jay Program to Compute the nth Fibonacci Number
Figure 2.19

21 Sketch of the Abstract Syntax of a Jay WhileStatement
Figure 2.20


Download ppt "C H A P T E R T W O Syntax."

Similar presentations


Ads by Google