DOC PREVIEW
UMBC CMSC 331 - LECTURE NOTES

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

UMBC CMSC 331 ONLINE LECTURE 3 PART1What is Left Recursion?What’s the General Rule?Removing Left RecursionThe MechanicsUMBC CMSC 331 ONLINE LECTURE 3 PART1SD VickWhat is Left Recursion?Left Recursion is when you have a grammar with one or more rules of the following formA -> A  | Example where  is and  is cA -> A a b | cIn the technique I’ll show you  can’t directly (or indirectly) start with A 1) A -> A a b | Ac is illegal 2) A -> A a b | Bc so is this B -> d | Ae A -> B -> A Why?Why?What’s the General Rule? A -> A  | A  | … A m | n A A’ |  A’ … n A’ A’ -> A’ | A’ | … m A’ | <z> -> <w>' ? <x> | <z> ! <y> | a <z><x> -> <z> * <x> | <x> / <y> | <w><w>-> e | fRemoving Left RecursionConsider the following GrammarWhy is this Left Recursive?Now we must justpick our ’sandour’sThe Mechanics <z> -> <w>' ? <x> | <z> ! <y> | a <z><z> -> <w>' ? <x> <z’> | a <z> <z’> <z’> -> ! <y> <z’> | Try the second rule on your ownHere we have 2 ‘s and 1 , what if the situation was


View Full Document

UMBC CMSC 331 - LECTURE NOTES

Documents in this Course
Semantics

Semantics

14 pages

Java

Java

12 pages

Java

Java

31 pages

V

V

46 pages

Semantics

Semantics

11 pages

Load more
Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?