Assignment_3 - ans

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

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

View Full Document Right Arrow Icon
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}
Background image of page 1

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

View Full DocumentRight Arrow Icon
<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 (
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/23/2011 for the course CSE 324 taught by Professor Soliman during the Spring '11 term at NMT.

Page1 / 3

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online