CSL411 Compiler Lab
Cycles
Cycle I: Application of LEX and YACC Tools
1. Design and implement a lexical analyzer using C language to recognize all
valid tokens in the input program. The lexical analyzer should ignore
redundant spaces, tabs and newlines. It should also ignore comments
2. Implement a Lexical Analyzer for a given program using Lex Tool
3. Write a lex program to display the number of lines, words and characters in an
input text
4. Write a LEX Program to convert the substring abc to ABC from the given input
string
5. Write a lex program to find out the total number of vowels and consonants
from the given input string
6. Generate a YACC specification to recognize a valid arithmetic expression that
uses operators +, – , *,/ and parenthesis
7. Generate a YACC specification to recognize a valid identifier which starts with
a letter followed by any number of letters or digits
8. Implementation of Calculator using LEX and YACC
9. Convert the BNF rules into YACC form and write code to generate abstract
syntax tree
Cycle II: Application problems using NFA and DFA
10. Write a program to find ε – closure of all states of any given NFA with ε
transition
11. Write a program to convert NFA with ε transition to NFA without ε transition
12. Write a program to convert NFA to DFA
13. Write a program to minimise any given DFA
Cycle III: Implementation of Parsers
14. Write a program to find First and Follow of any given grammar
15. Design and implement a recursive descent parser for a given grammar
16. Construct a Shift Reduce Parser for a given language
Cycle IV: Simulation of code optimization Techniques
17. Write a program to perform constant propagation
Cycle V: Implementation of Intermediate Code Generation
18. Implement Intermediate code generation for simple expressions
Cycle VI: Implementation of the back end of the compiler
19. Implement the back end of the compiler which takes the three address code
and produces the 8086 assembly language instructions that can be
assembled and run using an 8086 assembler. The target assembly
instructions can be simple move, add, sub, jump etc.
OBE Mapping Table
Cognitive Knowledge
Question
Level in Bloom's Course Outcome
Number
Taxonomy*
2, 3, 4, 5, CO1: Implement lexical analyzer using the tool
B3
8 LEX. (Cognitive Knowledge Level: Apply)
CO2: Implement Syntax analyzer using the tool
6, 7, 8, 9 B3
YACC. (Cognitive Knowledge Level: Apply)
CO3: Design NFA and DFA for a problem and write
10, 11, 12,
B3 programs to perform operations on it. (Cognitive
13
Knowledge Level: Apply)
CO4: Design and Implement Top-Down parsers.
14, 15 B3
(Cognitive Knowledge Level: Apply)
CO5: Design and Implement Bottom-Up parsers.
16 B3
(Cognitive Knowledge Level: Apply)
CO6: Implement intermediate code for expressions.
18 B3
(Cognitive Knowledge Level: Apply)
Remember - B1, Understand - B2, Apply - B3, Analyse - B4, Evaluate - B5, Create - B6