1 / 4

LL(1) PARSER

LL(1) PARSER. Eg:  Consider the following grammar: S --> iEtSS’ | a S’ --> eS | ع E --> b. First Follow S i,a $,e E b t

duy
Download Presentation

LL(1) PARSER

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LL(1) PARSER Eg:Consider the following grammar: S --> iEtSS’ | a S’ --> eS | ع E --> b

  2. First Follow S i,a $,e E b t S’ e,ع $,e

  3. The grammar is ambiguous and it is evident by the fact that we have two entries corresponding to M[S’,e] containing S -->ع and S->eS.This ambiguity can be resolved if we choose S’-->eS i.e associating the else’s with the closest previous “then”. LL(1) grammars have distinct properties.No ambiguous grammar or left recusive grammar can be LL(1).A grammar is LL(1) if and only if whenever a production A--> C | D the following conditions hold: 1)For no terminal a both C and D derive strings beginning with a.Thus First(C) != First(D) 2)At most one of C or D can derive € • 3) If C* ع then D doesnot derive any string beginning with terminal Follow(A).

More Related