recursive descent algorithm limitations n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Recursive Descent Algorithm Limitations PowerPoint Presentation
Download Presentation
Recursive Descent Algorithm Limitations

Loading in 2 Seconds...

play fullscreen
1 / 4

Recursive Descent Algorithm Limitations - PowerPoint PPT Presentation


  • 77 Views
  • Uploaded on

Recursive Descent Algorithm Limitations. Compilers. RDA Limitations. E  T |T + E T  int | int * T | ( E ) bool term(TOKEN tok ) { return *next++ == tok ; } bool E 1 () { return T(); } bool E 2 () { return T() && term(PLUS) && E(); }

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Recursive Descent Algorithm Limitations' - xanthe


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
rda limitations
RDA Limitations

E  T |T + E

T  int | int * T | ( E )

bool term(TOKEN tok) { return *next++ == tok; }

bool E1() { return T(); }

bool E2() { return T() && term(PLUS) && E(); }

bool E() {TOKEN *save = next; return (next = save, E1())

|| (next = save, E2()); }

bool T1() { return term(INT); }

bool T2() { return term(INT) && term(TIMES) && T(); }

bool T3() { return term(OPEN) && E() && term(CLOSE); }

bool T() { TOKEN *save = next; return (next = save, T1())

|| (next = save, T2())

|| (next = save, T3()); }

rda limitations1
RDA Limitations
  • If a production for non-terminal X succeeds
    • Cannot backtrack to try a different production for X later
  • Completely general recursive-descent algorithms support such “full” backtracking
rda limitations2
RDA Limitations
  • Presented recursive descent algorithm is not general
    • But is easy to implement by hand
  • Is sufficient for grammars where for any non-terminal at most one production can match
  • The example grammar can be rewritten to work with the presented algorithm
    • By left factoring, the topic of a future video