CS
exam1topicssol

Count a n count c n count a n count a n a a n count 1

• Notes
• 4

This preview shows pages 3–4. Sign up to view the full content.

> . count < a-n > . count < c-n > . count < a-n > . count < a-n > ::= a < a-n > . count 1 | < a-n > 1 a < a-n > . count < a-n > 1 . count + 1 < b-n > ::= b Condition: < b-n > . count = 1 | < b-n > 1 b < b-n > 1 . count < b-n > . count - 1 < c-n > ::= c Condition: < c-n > . count = 1 | < c-n > 1 c < c-n > 1 . count < c-n > . count - 1 (a) Indicate which attributes are inherited, which are synthesized, and which are intrinsic. inherited - count of <b-n> and <c-n> synthesized - count of <a-n> intrinsic - none (b) Draw the attributed parse tree for the string “aaabbbccc”, showing clearly the order of evaluation of all attributes.

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

<string> / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ / | \ <a-n> <b-n> <c-n> 3) count: 3 4) count: 3 5) count: 3 /\ /\ /\ / \ / \ / \ / \ / \ / \ / \ / \ / \ <a-n> a <b-n> b <c-n> c 2) count: 2 6) count: 2 9) count: 2 /\ /\ /\ / \ / \ / \ / \ / \ / \ / \ / \ / \ <a-n> a <b-n> b <c-n> c 1) count: 1 7) count: 1 10) count: 1 | 8) Condition: true 11) Condition: true | | | | | | a b c
This is the end of the preview. Sign up to access the rest of the document.
• Fall '09
• css, Context-free grammar, token

{[ snackBarMessage ]}

What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern