+ All Categories
Home > Documents > Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

Date post: 28-Mar-2015
Category:
Upload: abdul-wahid-khan
View: 1,317 times
Download: 4 times
Share this document with a friend
Description:
Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311
79
1 Top-Down Parser Top-Down Parser A top-down parser starts with the root of the parse tree. The root node is labeled with the goal symbol of the grammar
Transcript
Page 1: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

1

Top-Down ParserTop-Down ParserTop-Down ParserTop-Down Parser A top-down parser starts

with the root of the parse tree.

The root node is labeled with the goal symbol of the grammar

Page 2: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

2

Top-Down ParserTop-Down ParserTop-Down ParserTop-Down Parser A top-down parser starts

with the root of the parse tree.

The root node is labeled with the goal symbol of the grammar

Page 3: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

3

Top-Down Parsing AlgorithmTop-Down Parsing AlgorithmTop-Down Parsing AlgorithmTop-Down Parsing Algorithm

Construct the root node of the parse tree

Repeat until the fringe of the parse tree matches input string

Page 4: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

4

Top-Down Parsing AlgorithmTop-Down Parsing AlgorithmTop-Down Parsing AlgorithmTop-Down Parsing Algorithm

Construct the root node of the parse tree

Repeat until the fringe of the parse tree matches input string

Page 5: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

5

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing At a node labeled A, select

a production with A on its lhs

for each symbol on its rhs, construct the appropriate child

Page 6: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

6

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing At a node labeled A, select

a production with A on its lhs

for each symbol on its rhs, construct the appropriate child

Page 7: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

7

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing When a terminal symbol is

added to the fringe and it does not match the fringe, backtrack

Find the next node to be expanded

Page 8: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

8

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing When a terminal symbol is

added to the fringe and it does not match the fringe, backtrack

Find the next node to be expanded

Page 9: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

9

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing

The key is picking right production in step 1.

That choice should be guided by the input string

Page 10: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

10

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing

The key is picking right production in step 1.

That choice should be guided by the input string

Page 11: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

11

Expression GrammarExpression GrammarExpression GrammarExpression Grammar1 Goal → expr2 expr → expr + term3 | expr - term4 | term5 term → term * factor6 | term ∕ factor7 | factor8 factor → number9 | id10

| ( expr )

Page 12: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

12

Top-Down ParsingTop-Down ParsingTop-Down ParsingTop-Down Parsing

Let’s try parsing

x – 2 * y

Page 13: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

13

P Sentential Form input

- Goal x – 2 * y

1 expr x – 2 * y

2 expr + term x – 2 * y

4 term + term x – 2 * y

7 factor + term x – 2 * y

9 <id,x> + term x – 2 * y

9 <id,x> + term x – 2 * y

Page 14: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

14

This worked well except that “–” does not match “+”

P Sentential Form input

- Goal x – 2 * y

1 expr x – 2 * y

2 expr + term x – 2 * y

4 term + term x – 2 * y

7 factor + term x – 2 * y

9 <id,x> + term x – 2 * y

9 <id,x> + term x – 2 * y

Page 15: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

15

The parser must backtrack to here

P Sentential Form input

- Goal x – 2 * y

1 expr x – 2 * y

2 expr + term x – 2 * y

4 term + term x – 2 * y

7 factor + term x – 2 * y

9 <id,x> + term x – 2 * y

9 <id,x> + term x – 2 * y

Page 16: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

16

This time the “–” and “–” matched

P Sentential Form input- Goal x – 2 * y1 expr x – 2 * y2 expr – term x – 2 * y

4 term – term x – 2 * y7 factor – term x – 2 * y9 <id,x> – term x – 2 * y9 <id,x> – term x – 2 * y

Page 17: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

17

We can advance past “–” to look at “2”

P Sentential Form input- Goal x – 2 * y1 expr x – 2 * y2 expr – term x – 2 * y4 term – term x – 2 * y7 factor – term x – 2 * y9 <id,x> – term x – 2 * y9 <id,x> – term x – 2 * y- <id,x> – term x – 2 * y

Page 18: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

18

Now, we need to expand “term”

P Sentential Form input- Goal x – 2 * y1 expr x – 2 * y2 expr – term x – 2 * y4 term – term x – 2 * y7 factor – term x – 2 * y9 <id,x> – term x – 2 * y9 <id,x> – term x – 2 * y- <id,x> – term x – 2 * y

Page 19: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

19

P Sentential Form input- <id,x> – term x – 2 * y7 <id,x> – factor x – 2 * y9 <id,x> –

<num,2>x – 2 * y

- <id,x> – <num,2>

x – 2 * y

“2” matches “2”We have more input but no non-terminals left to expand

Page 20: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

20

The expansion terminated too soon

Need to backtrack

P Sentential Form input- <id,x> – term x – 2 * y7 <id,x> – factor x – 2 * y9 <id,x> –

<num,2>x – 2 * y

- <id,x> – <num,2>

x – 2 * y

Page 21: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

21

P Sentential Form input- <id,x> – term x – 2 * y5 <id,x> – term * factor x – 2 * y7 <id,x> – factor * factor x – 2 * y8 <id,x> – <num,2> *

factorx – 2 * y

- <id,x> – <num,2> * factor

x – 2 * y

- <id,x> – <num,2> * factor

x – 2 * y

9 <id,x> – <num,2> * <id,y>

x – 2 * y

- <id,x> – <num,2> * <id,y>

x – 2 * y

Success! We matched and consumed all the input

Page 22: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

22

Another Possible ParseAnother Possible ParseAnother Possible ParseAnother Possible ParseP Sentential Form input- Goal x – 2 * y1 expr x – 2 * y2 expr +term x – 2 * y2 expr +term +term x – 2 * y2 expr +term +term +term x – 2 * y2 expr +term +term +term

+....x – 2 * y

consuming no input!!Wrong choice of expansion leads to non-terminationParser must make the right choice

Page 23: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

23

Left RecursionLeft RecursionLeft RecursionLeft Recursion

Top-down parsers cannot handle left-recursive

grammars

Page 24: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

24

Left RecursionLeft RecursionLeft RecursionLeft RecursionFormally,

A grammar is left recursive if A NT such that a derivation A * A , for some string (NT T)*

Page 25: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

25

Left RecursionLeft RecursionLeft RecursionLeft Recursion Our expression grammar is

left recursive.

This can lead to non-termination in a top-down parser

Page 26: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

26

Left RecursionLeft RecursionLeft RecursionLeft Recursion Our expression grammar is

left recursive.

This can lead to non-termination in a top-down parser

Page 27: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

27

Left RecursionLeft RecursionLeft RecursionLeft Recursion

Non-termination is bad in any part of a compiler!

Page 28: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

28

Left RecursionLeft RecursionLeft RecursionLeft Recursion For a top-down parser, any

recursion must be a right recursion

We would like to convert left recursion to right recursion

Page 29: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

29

Left RecursionLeft RecursionLeft RecursionLeft Recursion For a top-down parser, any

recursion must be a right recursion

We would like to convert left recursion to right recursion

Page 30: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

30

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion

To remove left recursion, we transform the grammar

Page 31: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

31

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion

Consider a grammar fragment:

A → A |

where neither nor starts with A.

Page 32: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

32

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left RecursionWe can rewrite this as:

A → A'

A' → A' |

where A' is a new non-terminal

Page 33: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

33

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left RecursionWe can rewrite this as:

A → A'

A' → A' |

where A' is a new non-terminal

Page 34: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

34

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion

A → A ' A' → A'

|

This accepts the same language but uses only right recursion

Page 35: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

35

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion

The expression grammar we have been using contains two cases of left- recursion

Page 36: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

36

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion

expr → expr + term | expr – term | term

term → term * factor | term ∕ factor | factor

Page 37: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

37

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left RecursionApplying the transformation yields

expr → term expr' expr' → + term expr'

| – term expr' |

Page 38: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

38

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion

Applying the transformation yields

term → factor term' term' → * factor term'

| ∕ factor term' |

Page 39: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

39

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion These fragments use only

right recursion They retain the original left

associativity A top-down parser will

terminate using them.

Page 40: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

40

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion These fragments use only

right recursion They retain the original left

associativity A top-down parser will

terminate using them.

Page 41: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

41

Eliminating Left RecursionEliminating Left RecursionEliminating Left RecursionEliminating Left Recursion These fragments use only

right recursion They retain the original left

associativity A top-down parser will

terminate using them.

Page 42: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

42

1 Goal → expr2 expr → term expr' 3 expr' → + term expr' 4 | – term expr'5 | 6 term → factor term' 7 term' → * factor term' 8 | ∕ factor term'9 | 10 factor → number11 | id12 | ( expr )

Page 43: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

43

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing If a top down parser picks

the wrong production, it may need to backtrack

Alternative is to look ahead in input and use context to pick correctly

Page 44: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

44

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing If a top down parser picks

the wrong production, it may leed to backtrack

Alternative is to look ahead in input and use context to pick correctly

Page 45: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

45

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing How much lookahead is

needed?

In general, an arbitrarily large amount

Page 46: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

46

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing How much lookahead is

needed?

In general, an arbitrarily large amount

Page 47: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

47

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing Fortunately, large classes

of CFGs can be parsed with limited lookahead

Most programming languages constructs fall in those subclasses

Page 48: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

48

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing Fortunately, large classes

of CFGs can be parsed with limited lookahead

Most programming languages constructs fall in those subclasses

Page 49: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

49

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingBasic Idea:

Given A → | , the parser should beable to choose between and .

Page 50: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

50

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingFIRST Sets:

For some rhs G, define FIRST() as the set of tokens that appear as the first symbol in some string that derives from .

Page 51: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

51

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

That is,x FIRST()

iff xfor some.

Page 52: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

52

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

The LL(1) PropertyIf A → and A → both appear in the grammar, we would like FIRST() FIRST() =

Page 53: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

53

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingPredictive parsers accept LL(k) grammars

“left-to-right” scan of input

left-most derivation

LL(k) “k” tokens of lookahead

Page 54: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

54

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingThe LL(1) Property

FIRST() FIRST() = allows the parser to make a correct choice with a lookahead of exactly one symbol!

Page 55: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

55

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

What about -productions?

They complicate the definition of LL(1)

Page 56: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

56

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

What about -productions?

They complicate the definition of LL(1)

Page 57: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

57

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

If A → and A → and FIRST() , then we need to ensure that FIRST() is disjoint from FOLLOW(), too

Page 58: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

58

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

FOLLOW() is the set of all words in the grammar that can legally appear after an .

Page 59: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

59

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

For a non-terminal X,

FOLLOW(X ) is the set of symbols that might follow the derivation of X.

Page 60: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

60

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

FIRST and FOLLOWX

FIRST FOLLOW

Page 61: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

61

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

Define FIRST+() as

FIRST() FOLLOW(), if FIRST()

FIRST(), otherwise

Page 62: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

62

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

Then a grammar is LL(1) iff A → and A → implies

FIRST+() FIRST+() =

Page 63: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

63

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingGiven a grammar that has the is LL(1) property

• we can write a simple routine to recognize each lhs

• code is simple and fast

Page 64: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

64

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingGiven a grammar that has the is LL(1) property

• we can write a simple routine to recognize each lhs

• code is simple and fast

Page 65: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

65

Predictive ParsingPredictive ParsingPredictive ParsingPredictive ParsingGiven a grammar that has the is LL(1) property

• we can write a simple routine to recognize each lhs

• code is simple and fast

Page 66: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

66

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

Consider A → 1 23 which satisfies the LL(1) property FIRST+()FIRST+

() =

Page 67: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

67

/* find an A */if(token FIRST(1)) find a 1 and return trueelse if(token FIRST(2)) find a 2 and return trueif(token FIRST(3)) find a 3 and return trueelse error and return false

Page 68: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

68

/* find an A */if(token FIRST(1)) find a 1 and return trueelse if(token FIRST(2)) find a 2 and return trueif(token FIRST(3)) find a 3 and return trueelse error and return false

Page 69: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

69

/* find an A */if(token FIRST(1)) find a 1 and return trueelse if(token FIRST(2)) find a 2 and return trueif(token FIRST(3)) find a 3 and return trueelse error and return false

Page 70: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

70

/* find an A */if(token FIRST(1)) find a 1 and return trueelse if(token FIRST(2)) find a 2 and return trueif(token FIRST(3)) find a 3 and return trueelse error and return false

Page 71: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

71

/* find an A */if(token FIRST(1)) find a 1 and return trueelse if(token FIRST(2)) find a 2 and return trueif(token FIRST(3)) find a 3 and return trueelse error and return false

Page 72: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

72

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing

Grammar with the LL(1) property are called predictive grammars because the parser can “predict” the correct expansion at each point in the parse.

Page 73: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

73

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing Parsers that capitalize on

the LL(1) property are called predictive parsers

One kind of predictive parser is the recursive descent parser

Page 74: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

74

Predictive ParsingPredictive ParsingPredictive ParsingPredictive Parsing Parsers that capitalize on

the LL(1) property are called predictive parsers

One kind of predictive parser is the recursive descent parser

Page 75: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

75

Recursive Descent ParsingRecursive Descent ParsingRecursive Descent ParsingRecursive Descent Parsing1 Goal → expr2 expr → term expr' 3 expr' → + term expr' 4 | - term expr'

5 | 6 term → factor term' 7 term' → * factor term' 8 | ∕ factor term'

9 | 10 factor → number11 | id

12 | ( expr )

Page 76: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

76

Recursive Descent ParsingRecursive Descent ParsingRecursive Descent ParsingRecursive Descent Parsing

This leads to a parser with six mutually recursive routines

Goal TermExpr TPrimeEPrime Factor

Page 77: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

77

Recursive Descent ParsingRecursive Descent ParsingRecursive Descent ParsingRecursive Descent Parsing

Each recognizes one non-terminal (NT) or terminal (T)

Goal TermExpr TPrimeEPrime Factor

Page 78: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

78

Recursive Descent ParsingRecursive Descent ParsingRecursive Descent ParsingRecursive Descent Parsing

The term descent refers to the direction in which the parse tree is built.

Here are some of these routines written as functions

Page 79: Top Down Parser - Compiler Design - Dr. D. P. Sharma - NITK Surathkal by wahid311

79

Recursive Descent ParsingRecursive Descent ParsingRecursive Descent ParsingRecursive Descent Parsing

The term descent refers to the direction in which the parse tree is built.

Here are some of these routines written as functions


Recommended