{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Assignment_3 - ans

# Assignment_3 - ans - CSE324 Spring 2011 Homework#3 Due Date...

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

CSE324 Spring 2011 Homework #3 Due Date : Tuesday, April 5 th , 2011 ( in class ) Solve the following problems : 1) Do Exercise 4.7 page 152 . ( 40 pts ) <id> ::= <ltr><string><undscr str> | <ltr><undscr str> <str>::= <ltr> <str> | <digit> <str> | <ltr> | <digit> <underscore str> ::= _ <str><underscore str> | _ <str> 2) Augment the answered BNF description in problem (1)above with the code that makes it an attribute grammar that is able to enforce a condition on the identifier's length, e.g., if its length is L, then 1 L n . (30 pts) <id> ::= <ltr> <str> <undscr str> {Value ( <id> ) = 1+Value( <str> )+Value( <undscr str> ) if Value ( <id> )> n then error } | <ltr> <undscr str> {Value ( <id> ) = 1+Value( <undscr str> ) if Value ( <id> )> n then error}

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

View Full Document
<str>::= <ltr> <str> {Value ( <str> ) = Value ( <str> )+1 if Value ( <str> )> n then error} | <digit> <str> {Value ( <str> ) = Value ( <str> )+1 if Value ( <str> )> n then error } | <ltr> {Value ( <str> ) = 1 } | <digit> {Value ( <str> ) = 1 } < undscr str> ::= _ <str> <undscr str> {Value ( <undscr str > ) = 1+Value( <str> )+Value( <undscr str >
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

Assignment_3 - ans - CSE324 Spring 2011 Homework#3 Due Date...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online