blob: 9b237e4ae569192cfc08d982f3458ca0e93fe228 (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
|
#include "foci.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
N(dot, ".", 0) {
STASH;
printf("%ld ", *sp);
RESTORE;
++sp;
NEXT;
}
int main()
{
char buf[128];
init();
define(&w_dot);
for (;;) {
char c;
do c = getchar();
while (!isgraph(c));
char *s = buf;
do {
*s++ = c;
c = getchar();
} while (isgraph(c));
*s = '\0';
if (strcmp(buf, "bye") == 0)
break;
parse_word(buf, s);
printf(compiling() ? "compiled <%d>\n" : "ok <%d>\n", depth());
}
return 0;
}
|