aboutsummaryrefslogtreecommitdiff
path: root/5.20/main.c
diff options
context:
space:
mode:
Diffstat (limited to '5.20/main.c')
-rw-r--r--5.20/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/5.20/main.c b/5.20/main.c
new file mode 100644
index 0000000..6338524
--- /dev/null
+++ b/5.20/main.c
@@ -0,0 +1,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;
+}