{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lec13Parse - Notetakers Justin Miller and Kenrick Goldson...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Notetakers: Justin Miller and Kenrick Goldson COT 4210 Discrete Structures II 4 common searches: Breadth-First Top-Down Depth-First Top-Down Breadth-First Bottup-Up Depth-First Bottom-Up Algorithm: beginning at beginning of queue, explore all nodes of depth 1, then 2, 3, etc. Example I – Breadth-First Search( Top-Down ): Using the following, we derive a breadth-first top-down search for the expression (b+b). V = {S, A, T} ∑ = {b, +, (, )} 1. S A 2. A T 3. A A + T 4. T b 5. T (A) ( b ) / b ( T ) --- ( ( A ) ) / / T --- ( A ) --- ( A + T ) / S --- A b + T \ / A + T --- T + T --- ( A ) + T \ A + T + T --- T + T + T \ A + T + T + T NOTE: If string bb+ is searched for using Breadth-First Search Top-Down parsing method, it is possible for the search to continue forever since it is not part of the language.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Example II – Depth-First Search( Top-Down ): Using the same example, we search depth-first top-down for the expression (b+b). S / T / \ b (A) / \ (T) (A+T) / \ \ (b) ((A)) (T+T) / ( b + T ) / ( b + b ) Working backwards (bottom-up), we show that ( b + b ) is in the grammar S. ( b + b ) ( T + b ) ( A + b ) ( A + T ) ( A ) T A S An issue with this parsing method is that if one of the nodes goes on forever, then you will never get to the rest of the tree A stack keeps track of
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern