cd lab-2015-16

Upload: naveen-yallapu

Post on 06-Jul-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/17/2019 CD LAB-2015-16

    1/3

      GATES INSTITUTE OF TECHNOLOGY

    DEPARTMENT OF “COMPUETER SCIENCE AND ENGINEERING” 

      GOOTY.

     COMPILER DESIGN LAB

    III B.Tech-I SEM

    S.NO  LIST OF EXPERIMENTS/TASKS

    1.Write a program to search for a given pattern in a set of files. It should support regular expressions.It should work similar to grep and fgrep of Linux environment.

    2. Write programs for DFA, NFA.

    3.

    onsider the following regular expressions!

    a" #$ % &"' $%&"#$%&" (" #a('c % #def"% % a'd%e"%

    c" ##a % ("'#c % d"'"% % a('c'd

    Write separate programs for recogni)ing the strings generated (* each of the

    regular expressions mentioned a(ove #+sing FA".

    .

    iven a text-file which contains some regular expressions, with onl* one / in each

    line of the file. Write a program which accepts a string from the user and reports which regular 

    expression accepts that string. If no / from the file accepts the string, then report that no /is matched.

    !.

    Design a 0DA for an* given NF. 1imulate the processing of a string using the 0DA and show the

     parse tree.

    ".

    Design a Lexical anal*)er for identif*ing different t*pes of tokens used in language.

     Note: The reserved keywords such as if, else, class, struct etc must be reported as

    invalid identifiers. C allows identifier names to begin with underscore character too.

    #. 1imulate a simple desktop calculator using an* lexical anal*)er generator tool #L/2 or FL/2".

    $.0rogram to recogni)e the identifiers, if and switch statements of using a lexicalanal*)er generator tool.

    %. onsider the following grammar!

    1 --3 A4

    A--3 a(A 5 a(4--3 ( 5 4

    --3 c 5 c

    Design an* shift reduced parser which accepts a string and tells whether the

  • 8/17/2019 CD LAB-2015-16

    2/3

    string is accepted (* a(ove grammar or not.

    1&.

    Design a 6A program that reads a program from input file and identif* all

    valid identifiers and for loop statements.

    11. 0rogram to eliminate left recursion and left factoring from a given F.

    12. 6A program that reads the input expression and convert it to post fix expression.

    13.

    6A program that finds varia(le declarations in source file and save them

    into the s*m(ol ta(le, which is organi)ed using (inar* search tree.

    1.

    6A program that reads the statements from an input file and converts

    them into 7uadruple three address intermediate code

    1taff signature 8oD 0rincipal

  • 8/17/2019 CD LAB-2015-16

    3/3