CD Lab List
CD Lab List
UNIT I
2. Implement transition diagram for identifying constant and classify whether it is integer or
real.
3. Write a LEX program to count number of characters, words, lines, and blanks in the given
input file.
4. Write a LEX program to recognize all the tokens in the given input file. Here the input file
is having source code.
UNIT II
5. Write a program which reads CFG and check for left recursion then display the CFG after
elimination of left recursion.
6. Write a program which reads CFG and if required apply the left factoring then display the
resulting CFG.
7. Write a program to implement Recursive Descent Parser for the given grammar.
UNIT III
8. Write a program to check given expression is valid or not using YACC for the following
grammar.
E -> E+E
E -> E-E
E -> E*E
E -> E/E
E -> E%E
E -> (E)
E -> number
E ->id
UNIT IV
9. Write a program to evaluate the given expression using LEX and YACC for the following
grammar.
E -> E+E
E -> E-E
E -> E*E
E -> E/E
E -> E%E
E -> (E)
E -> number
E -> id
10. Write a program to covert infix expression to postfix expression using LEX and YACC for
the following grammar.
11. Write a program to generate Quadruples (Three address code) for the given expression
using LEX and YACC for the following grammar.
E -> E+E
E -> E-E
E -> E*E
E -> E/E
E -> E%E
E -> (E)
E -> number
E -> id
UNIT V
12. Write a program to implement simple Code Generator for the given three address code.