1 Lex
1 Lex
1 Lex
#include<stdbool.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
if (ch == ' ' || ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == ',' || ch == ';' || ch == '>' || ch == '<' ||
ch == '=' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}')
return (true);
return (false);
ch == '=')
return (true);
return (false);
Page No.:
str[0] == '9' || isDelimiter(str[0]) == true)
return (false);
return (true); }
!strcmp(str, "break") ||
return (true);
return (false); }
if (len == 0)
return (false);
Page No.:
&& str[i] != '3' && str[i] != '4' && str[i] != '5'
return (false); }
return (true); }
if (len == 0)
return (false);
return (false);
if (str[i] == '.')
hasDecimal = true;
return (hasDecimal);
int i;
Page No.:
char* subStr = (char*)malloc(
return (subStr);
if (isDelimiter(str[right]) == false)
right++;
if (isOperator(str[right]) == true)
right++;
left = right;
if (isKeyword(subStr) == true)
Page No.:
printf("%s IS AN INTEGER\n", subStr);
left = right;
}}}
int main()
parse(str);
getch();
OUTPUT:
RESULT:
Page No.: