Compiler Design Task1
Compiler Design Task1
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
char code[1000], str[10], c;
int num[100], lineno = 1, tokenvalue = 0, i = 0, j = 0, k = 0;
printf("\nProcessing...\n");
// Handling numbers
if (isdigit(c)) {
tokenvalue = c - '0';
while (isdigit(code[++pos])) {
tokenvalue = tokenvalue * 10 + (code[pos] - '0');
2200490
}
num[i++] = tokenvalue;
pos--; // Step back to process next character
}
// Output results
printf("\nThe numbers in the program are: ");
for (j = 0; j < i; j++)
printf("%d ", num[j]);
return 0;
}
2200490
Output:
2200490
Practical 2
Aim: WAP to identify whether the given line is comment or not.
#include <stdio.h>
#include <string.h>
int main() {
char line[200];
return 0;
}
Output:
2200490