02-10-2012, 12:07 PM
Compiler Design List of Experiment
Compiler Design.doc (Size: 33.5 KB / Downloads: 39)
1. To study about phases of a compiler.
2. To Study about Lexical Analyzer Generator(LEX).
3. To study and install Flex(Fast Lexical Analyzer).
4. Implement following programs using Lex.
a. Create a Lexer to print SITA for “sita” and RAMA for “rama”.
b. Create a Lexer to take input from text file and count no of characters, no. of lines & no. of words.
c. Create a Lexer to check whether input is floating point number, integer or string.
d. Write a Lex program to count number of vowels and consonants in a given input string.
5. Implement following programs using Lex.
a. Write a Lex program to recognize a string with three consecutive 0’s.
b. Write a Lex program to recognize strings ending in 00.
c. Write a Lex program to convert decimal number into hexadecimal.
d. Write a Lex to count the number of positive numbers, negative numbers, positive fractions and negative fractions.
e. Write a Lex program to convert string in lowercase into uppercase.
6. Implement following programs using Lex.
a. Write a Lex program to print out all numbers from the given file.
b. Write a Lex program to printout all HTML tags in file.
c. Write a Lex program which adds line numbers to the given file and display the same onto the standard output.
7. Implement Lex program for a postfix calculator.
8. Write a Lex program to count the number of comment lines in a given C program. Also eliminate them and copy that program into separate file.
9. Write a Lex program to count the number of printf and scanf statements in a given C program or file. Replace them with writef and readf statements respectively.
10. Write a program in Lex to eliminate multiple spaces and tabs and replace with a single space and remove empty lines.
11. To Study about Yet Another Compiler-Compiler(YACC).
12. Create Yacc and Lex specification files to recognizes arithmetic expressions involving +,-,* and / .
13. Create Yacc and Lex specification files to recognize the grammar.( anb , n>=10)
14. Create Yacc and Lex specification files to recognize ‘aaab’ , ’abbb’ , ’ab’ and ‘a’ using grammar.
15. Create Yacc and Lex specification files are used to recognize addresses which are in a specific format only.
16. Create Yacc and Lex specification files are used to generate a calculator which accepts, integer and float type arguments.