{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw5 - expression – this will help with justifying that...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
VERSION: October 2, 2010 CS-441 Fall 2010 JWJ CS UK Homework Assignment # 4 —This material is only for use in CS441-Fall 2010 in the Department of Computer Science at the University of Kentucky.— —Please, do not distribute.— Due: solve by Tuesday, Oct 5, 2010 Learning outcomes: This assignments relates to the material on CFG grammars and their properties. The assignment contributes to the following learning outcomes for this course: LO designing grammar for a small language LO top-down parsing and LL(1) grammars hw5 This assignment is a continuation of our class exercise. It is a group assignment (as we worked in our classroom) and one solutuion from each group is sufficient. All the team-member names should be listed in the submission. For this homework assignment, you are supposed to return a context-free grammar for the IF language. The grammar should be suitable for LL(1) parsing and some analysis and justification that the grammar is LL(1) should
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: expression – this will help with justifying that your grammar for IF is also LL(1). The language is defined in the handout distributed in class and is also provided below. Consider a (portion of) language IF for branching instructions: 10: if (x+1 > y) then 20 else 30; 20: if (3*x-z > 3.1) then 20 else 50; 30: if (3-y+1 == 25*z-11) then 50 else action2; 40: if (x+1 > y) then action3 else 30; 50: if (z+1 < y) then 60 else 30; 60: if (x*2+11 != y) then 50 else exit; The general structure of a program is that it consists of a number of labeled lines, each starting with a label followed by an if-then-else statement. The first part after if is a relation expression (comparison of two expres-sions). The actions are either ’jumps’ marked by numbers corresponding to labels, action# (where # is a number), or exit . 1...
View Full Document

{[ snackBarMessage ]}