Homework-1 - (b) The language has the following operator...

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

View Full Document Right Arrow Icon
COP4020 Spring 2011 Homework-1 1. Consider the following context-free grammar: S → SASB S → d A → Aa A → e B → Bb B → Cc C → c (a) Show that the grammar is not LL(1). (b) Modify the grammar so that it becomes LL(1). (c) Construct the corresponding LL(1) parse table. (d) Write the skeleton of the corresponding recursive descent parser. 2. Write a context free grammar with the following characteristics: (a) The language is composed of expressions, with operators and the atomic symbol 'a';
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (b) The language has the following operator precedence hierarchy: Precedence Operator Type Associativity 1 == < > Binary Infix Left 2 + - Binary Infix Right 3 / Binary Infix Left 4 ! Unary Prefix None 5 ; Unary Postfix None 6 ( ) Embedding None (c) Show the derivation tree and the abstract syntax tree for the following expression: a * a a * !a + a / ( a; ) < a...
View Full Document

Ask a homework question - tutors are online