3
3
h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
return true;
}
return false;
}
return true;
}
// Skipping delimiters
if (isDelimiter(input[right])) {
if (input[right] != ' ') // Ignore spaces
printf("Token: Delimiter, Value: %c\n", input[right]);
right++;
left = right;
continue;
}
if (isKeyword(subStr))
printf("Token: Keyword, Value: %s\n", subStr);
else if (isNumber(subStr))
printf("Token: Number, Value: %s\n", subStr);
else if (isValidIdentifier(subStr))
printf("Token: Identifier, Value: %s\n", subStr);
else
printf("Token: Unidentified, Value: %s\n", subStr);
// Main function
int main() {
char lex_input[MAX_LENGTH] = "int main() { int a = 10, b = 20; float c = 3.14;
if (a >= b) printf(\"Hello World!\"); return 0; }";
return 0;
}