Compiler Design Lab Assignment Lab 4
Compiler Design Lab Assignment Lab 4
19U02003
Question-Write a program to generate tokens for the given program, ignore redundant spaces, tabs and
new lines. It should also ignore comments. print the count of identifiers, keyword, operators.
Solution-
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
return (true);
return (false);
ch == '=')
return (true);
return (false);
return (false);
return (true);
!strcmp(str, "break") ||
return (true);
return (false);
if (len == 0)
return (false);
return (false);
}
return (true);
if (len == 0)
return (false);
return (false);
if (str[i] == '.')
hasDecimal = true;
return (hasDecimal);
int i;
return (subStr);
if (isDelimiter(str[right]) == false)
right++;
if (isOperator(str[right]) == true)
left = right;
if (isKeyword(subStr) == true)
left = right;
}
}
return;
// DRIVER FUNCTION
int main()
return (0);