Mehran University of Engineering and Technology, Jamshoro Deparment of Computer Systems Engineering Subject: Compiler Construction
Mehran University of Engineering and Technology, Jamshoro Deparment of Computer Systems Engineering Subject: Compiler Construction
#include <stdio.h>
#include <string.h>
Void main()
{ Char input[50], store[20];
Int i,j;
Printf(\neneter the input );
Scanf( %s,input);
Printf(%s,input);
Printf(\n);
For (i = 0 ; input[i] != NULL ;i++)
{
If(input[i] != : )
{
Store[i] = input[i];
Else
Printf(%c identifier \n ,store[i]);
}
Else printf(\n);
}
}
Tasks:
1. Identify the lexemes that makes up the tokens in the following program. Give reasonable
attribute values for the tokens
int max ( i , j ) int i , j;
{
Return i>j ? i:j;
}
2. In a string of length n, how many of the following are there?
a) Prefixes
b) Suffixes
c) Substrings