Pages

System Programming and Compiler Design

Lex Programs:


1. Lex Program to Count the Number of Lines and Characters in the Input File
2. Lex program that implements the Caesar cipher
3. Lex program to find the length of the longest word
4. Lex program that distinguishes keywords, integers, floats, identifiers, operators, and comments
5. Lex program to count the number of identifiers
6. Lex program to count the number of words,small and capital letters, digits and special characters in a C file
7. Lex specification program that generates a C program which takes a string “abcd” and prints the pattern
8. Lex program to recognize a valid arithmetic expression

Yacc Programs:


1. Program in YACC to evaluate an expression (simple calculator program for addition and subtraction, multiplication, division)
2. Program in YACC to recognize the string „abbb^n, „ab^n „a^n of the langauge (a^n b^n , n>=1)
3. Program in YACC to recognize the language (a^n b , n>=10). (output to say input is valid or not)


7 comments: