Programs with lex and yacc.
-
Write a Lex program to count the number of lines and characters in the input file.
-
Write a Lex program that implements the Caesar cipher: it replaces every letter with the one three letters after in alphabetical order, wrapping around at Z. e.g. a is replaced by d, b by e, and so on z by c.
-
Write a Lex program that finds the longest word (defined as a contiguous string of upper and lower case letters) in the input.
-
Write a Lex program that distinguishes keywords, integers, floats, identifiers, operators, and comments in any simple programming language.
-
Write a Lex program to count the number of identifiers in a C file.
-
Write a Lex program to count the number of words, characters, blank spaces and lines in a C file.
-
Write a Lex specification program that generates a C program which takes a string “abcd” and prints the following output.
abcd
abc
ab
a
-
A program in Lex to recognize a valid arithmetic expression.
-
Write a YACC program to find the validity of a given expression (for operators + - * and /)A program in YACC which recognizes a valid variable which starts with letter followed by a digit. The letter should be in lowercase only.
-
A Program in YACC to evaluate an expression (simple calculator program for addition and subtraction, multiplication, division).
-
Program in YACC to recognize the string „abbb‟, „ab‟ „a‟ of the langauge (a^nb^n , n>=1).
-
Program in YACC to recognize the language (a^nb , n>=10). (output to say input is valid or not)