You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
637 B
C
45 lines
637 B
C
#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;
|
|
}
|
|
|