Skip to content

DasariJayanth/Compiler-Design-Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compiler-Design-Lab

This repository contains problems from Compiler Design Lab.
Each Lab has a doc in it, a self explanatory report of format:

  1. Aim
  2. Procedure/Explanation
  3. Code
  4. Input/Output Screen shot
  5. Inference
    And the lex code file is also uploaded seperately.

LAB-1

1a :
Write a program for lex/flex scanner generator to identify valid identifiers.
input : a string
output : valid/invalid
1b :
Write a program for lex/flex scanner generator to count the number of vowels or consonants.
input : a string
output : number of vowels in the string is -----, number of consonants in the string is -----

LAB-2

2a :
Write a program for lex/flex scanner generator to determine the length of the longest word in the given string.
Input : String
Output : Length of the longest word is -----
2b :
Write a program for the lex/flex scanner generator to do Decimal to Binary Conversion.
Input : Decimal Number
Output : Binary Number

LAB-3

3a :
Write a program for lex/flex scanner generator to determine the character with the highest frequency in the given string.
Input : String
Output : Frequency is ----- and the character with the highest frequency is -----
3b :
Write a program for the lex/flex scanner generator to do Infix to Postfix Conversion.
Input : Infix
Output : Postfix

LAB-4

4a :
Write a program for lex/flex scanner generator to construct a DFA which accepts the language in which all the strings end with “00” over inputs ‘0’ and ‘1’.
Input : String of 0 and 1
Output : Accepted/Not accepted
4b :
Write a program for the lex/flex scanner generator to construct a DFA which accepts the language in which all strings have an even number of 1’s and even number of 0's over inputs ‘0’ and ‘1’.
Input : String of 0 and 1
Output : Accepted/Not accepted

LAB-5

5a :
Write a program for lex/flex scanner generator to input a series of numbers and output the count of Positive numbers, Negative numbers, and Fractions.
Input: Series of numbers(ex:2,-7,8.5, 3,26)
Output :
Positive :---
Negative :---
Fractions :---

LAB-6

6a :
Write a program for lex/flex scanner generator to print the total characters and white spaces.
Output:
Total no of characters -----
Total no of White spaces -----

LAB-7

7a :
Write a program for lex/flex scanner to recognize strings aaab, abbb using a^nb^n, where n>=0
Input : String
Output : Valid/Invalid