aboutsummaryrefslogtreecommitdiff
path: root/5.20/main.c
blob: 63385249f8909ad98547aa34712e839ccb5557d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdio.h>
#include <string.h>
#include "token.h"
#include "getch.h"
#include "dcl.h"

char datatype[MAXTOKEN];

int main(void)
{
	while (gettoken() != EOF) {
		if (tokentype == '\n') /* skip empty lines */
			continue;

		datatype[0] = '\0';
		do {
			strcat(datatype, token);
			strcat(datatype, " ");
		} while (gettoken() == NAME && isdatatyp());
		prevtoken = YES;

		if (tokentype == EOF)
			break;

		out[0] = '\0';
		dcl();
		if (tokentype != '\n')
			printf("synatx error\n");
		printf("%s: %s %s\n", name, out, datatype);
	}

	return 0;
}