aboutsummaryrefslogtreecommitdiff
path: root/docs/history/10-zc/code/examples/repl.zc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/history/10-zc/code/examples/repl.zc')
-rw-r--r--docs/history/10-zc/code/examples/repl.zc27
1 files changed, 0 insertions, 27 deletions
diff --git a/docs/history/10-zc/code/examples/repl.zc b/docs/history/10-zc/code/examples/repl.zc
deleted file mode 100644
index 49a8c7b..0000000
--- a/docs/history/10-zc/code/examples/repl.zc
+++ /dev/null
@@ -1,27 +0,0 @@
-// a repl on the resident compiler: each backtick-separated chunk of input is
-// compiled as a function body and run. definitions (fn ...) can be loaded too:
-// a chunk that starts with "fn" goes through load instead of eval.
-var buf[4000];
-fn readchunk()
-{
- var n = 0, c;
- while (!eof()) {
- c = getc();
- if (c == 96) break;
- if (n < 3999) { buf[n] = c; n++; }
- }
- buf[n] = 0;
- return n;
-}
-fn main()
-{
- var q, i;
- while (!eof()) {
- readchunk();
- q = tokens(buf);
- if (q[0] && q[1] == T_ID && q[2] == intern("fn")) load(q);
- else eval(q);
- free(q as d);
- }
- return 0;
-}