DAY 1
Program 1: Link
Lex program to recognize if digit or letter.
Sample Input : abc
Sample Output : letters
Sample Input : 123
Sample Output : digit(s)
DAY 2
Program 1: Link
Lex program to check if digit or not.
Sample Input : 1
Sample Output: This is a digit
Sample Input : ab
Sample Output :This is not a digit
Program 2: Link
Lex program to recognize whether string contains only letters or not.
Sample Input: abc
Sample Output: This contains alphabets
Sample Input : 12
Sample Output : this has other characters
Program 3: Link
Lex program to recognize whether string contains uppercase, lowercase or both.
Sample Input: abc
Sample Output: This is a lowercase letters
Sample Input : ABC
Sample Output: This is a uppercase letters
Sample Input : aBcD
Sample Output : It has both cases
DAY 3
Program 1: Link
Lex program to recognize vowels or consonants.
Sample Input: aeo
Sample Output: Contains only vowels
Sample Input : abcd
Sample Output : contains both vowels and consonants
Sample Input : bfg
Sample Output : Contains only consonants
Program 2: Link
Lex program to count number of characters in a string.
Sample Input : hello 52
Sample Output : 8
Program 3: Link
Lex program to count the composition of the string (vowels, consonants, digits & spaces)
Sample Input : $hAppy bIrthday $ 50@
Sample Output : Number of Vowels: 3
Number of Consonants: 10
Number of digits: 2
Number of space: 3
Number of other characters: 3
DAY 4
Program 1: Link
Lex program to verify valid keyword or not.
Sample Input: else
Sample Output : else is the keyword
Sample Input : him
Sample Output: him is not a keyword
Sample Input : not
Sample Output : not is not a keyword
Sample Input : while
Sample Output : while is the keyword
Program 2: Link
Lex program to verify valid identifier.
Sample Input: sum
Sample Output: sum is a valid identifier
Sample Input: 12
Sample Output: 12 is an invalid identifier
Sample Input : float
Sample Output : float is an invalid identifier
Sample Input : FLOA
Sample Output : FLOAT is valid identifier
Sample Input : a1_b
Sample Output : a1_b is an invalid identifier
Program 3: Link
Lex program to determine input operators whether arithmetic or logical.
Sample Input: +
Sample Output :+ is a valid arithmetic operator
Sample Input : ||
Sample Output: || is a valid logical operator
Sample Input : @
Sample Output: @ is not a valid operator
Program 4: Link
Lex program to recognize basic operators (PLUS(+), MINUS(-), GE(>=), LE(<=) ).
Sample Input: >=
Sample Output: Greater or equal to operator
Sample Input: <=
Sample Output: Lesser or equal to operator
Sample Input: +
Sample Output: PLUS operator.
Sample Input: -
Sample Output: MINUS operator
Sample Input: &
Sample Output: invalid operator!
Program 5: Link
Lex program to recognize float and int data types.
Sample Input: 58
Sample Output: 58 is an int value
Sample Input: 6.63
Sample Output: 6.63 is a float value
Sample Input: a
Sample Output: a is Invalid
DAY 5
Program 1: Link
Lex program to count the number of lexemes.
Sample Input: int a=5
Sample Output: count=4
Sample Input: float d=3.15
Sample Output: count=4
Sample Input: int sum=a+b;
Sample Output: count=7
Program 2: Link
Lex Program to count the number of identifier,lexemes,keywords,integers,fractions,and operators in the input.
Sample Input: float sum =5.3+4;
Sample Output: count of lexemes=7
count of keywords=1
count of identifiers=1
count of integers=1
count of fractions=1
count of operators=3
Program 3: Link
Lex program to check for valid url.
Sample Input: https://www.google.com
Sample Output: Valid URL
Sample Input: http://www/giraffe.co.in
Sample Output:Invalid URL
Sample Input: http://www.happy.net
Sample Output:Valid URL
DAY 6
Program 1: Link
Lex program to check for valid mobile number (India).
Sample Input: +918234556767
Sample Output: Valid Number
Sample Input: +918654345545
Sample Output: Valid Number
Sample Input: +9122222222222
Sample Output: Invalid Number
Program 2: Link
Lex program to check for valid email.
Sample Input: giraffe@gmail.com
Sample Output: Invalid email
Sample Input: happy3@gmail.com
Sample Output: Valid email
Sample Input:wellwisher44_4@gmail.com
Sample Output:Invalid email
Program 3: Link
Lex program to count the number of characters in an input file.
Sample file:inpfile.txt
Sample Input:hello World
hello world;
hola world!
Sample Output:35
DAY 7
Program 1: Link
Lex program to count the total number of characters, white spaces, tabs and new lines in the given input file.
Sample File:input.txt
Sample Input:hello world
@..... @.....
q q
Sample Output:
Line count: 4
Whitespaces count: 3
Tabs count: 1
Characters count: 24
Program 2: Link
Lex program to count the number of lexems in the given input file.
Sample File:-input.txt
Sample Input:int i=0;
for(i=3;i<n;i++)
{
a++;
}
Sample output:- Total no. of lexemes = 24
Program 3: Link
Lex program to read from an input file, remove multiple spaces, newline and tabs and write the result in an output file.
Sample Input File:-input.txt
Sample Input:hello world
@..... @.....
q q
Sample Output File:-output.txt
Sample Output:
DAY 8
Program 1: Link
Sample YACC Program
Sample Input:hi
Sample Output:Hello World
Sample Input:bye
Sample Output:Bye World
DAY 9
Program 1: Link
Lex and YACC programs to check whether a given string is Palindrome or Not.
Sample Input: Malayalam
Sample Output: pallindrome: malayalam
Sample Input: Anshika
Sample Output: not pallindrome: anshika
Program 2: Link
Write a program using Lex and YACC which accept strings that starts and ends with 0 or 1
Sample Input: 541
Sample Output: accepted.
Sample Input: 768
Sample Output: not accepted.