Computer Lab I index

, by Prashant Gunjal

1) Write a programm to recgnize static words from english

2 ) Lex programm to recgnize static words from english using structure

3) Lex program to recognize tokens from C program

4) 3) Write an ambiguous CFG to recognize an infix expression and implement a parser that recognizes the infix expression using YACC. Provide the details of all conflicting entries in the parser table generated by LEX and YACC and how they have been resolved. Input : Infix expressions with variables Output: a]Stepwise evaluation of expression, b] Symbol table c] explanation of conflicting entries in y.output file d] explanation for resolving the ambiguities

5) Write an ambiguous CFG to recognize an infix expression and implement a parser that recognizes the infix expression using YACC. Provide the details of all conflicting entries in the parser table generated by LEX and YACC and how they have been resolved. Input : Infix expressions with variables Output: a]Stepwise evaluation of expression, b] Symbol table c] explanation of conflicting entries in y.output file d] explanation for resolving the ambiguities

6) Write an attributed translation grammar to recognize declarations of variables, assignment statement with type checking as per syntax of C and generate equivalent three address code for the given input made up of constructs mentioned above using LEX and YACC. Write a code to store the identifiers from the input in a symbol table and also to record other relevant information about the identifiers. Display all records stored in the symbol table. Input: C code snippet Output: a] equivalent three address code b] Symbol table with type information c] Error handling for type checking


7) Write an attributed translation grammar to recognize declarations of variables, assignment statement & “while” statement as per syntax of C and generate equivalent three address code for the given input made up of constructs mentioned above using LEX and YACC. Write a code to store the identifiers from the input in a symbol table and also to record other relevant information about the identifiers. Display all records stored in the symbol table.

8) Write an attributed translation grammar to recognize declarations of variables, assignment statement & if- else statement as per syntax of C and generate equivalent three address code for the given input made up of constructs mentioned above using LEX and YACC. Write a code to store the identifiers from the input in a symbol table and also to record other relevant information about the identifiers. Display all records stored in the symbol table.

9) WAP to implement following code optimization techniques: a)common sub-expression elimination b)variable propagation

10 ) WAP to code optimization techniques: a)dead code elimination b) constant propagation

11) WAP to implement following code optimization techniques: a)strength reduction b) constant folding

12) WAP to label the tree for code generation. Input: Syntax Tree Output: Labelled syntax tree [use any tree traversal method]

13) WAP to generate the target code by using labelling algorithm. Input: Labelled tree Output: Target code

0 comments: