aboutsummaryrefslogtreecommitdiff
path: root/forth/step0_repl.fs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-21 15:58:41 -0600
committerJoel Martin <github@martintribe.org>2015-02-21 15:58:41 -0600
commit2a42d8274072c44dd2d83762cc27cd810f5b8452 (patch)
treec778c4319f93c89b85879c0dd60914813c4cf3db /forth/step0_repl.fs
parent5a5edd508d20775fddcb5931f263042d8e0d8fef (diff)
parent9603289087755c880fbb16b7e36eedef940237be (diff)
downloadmal-2a42d8274072c44dd2d83762cc27cd810f5b8452.tar.gz
mal-2a42d8274072c44dd2d83762cc27cd810f5b8452.zip
Merge pull request #7 from Chouser/forth-pr
Add Forth
Diffstat (limited to 'forth/step0_repl.fs')
-rw-r--r--forth/step0_repl.fs23
1 files changed, 23 insertions, 0 deletions
diff --git a/forth/step0_repl.fs b/forth/step0_repl.fs
new file mode 100644
index 0000000..2483c12
--- /dev/null
+++ b/forth/step0_repl.fs
@@ -0,0 +1,23 @@
+require types.fs
+
+: read ;
+: eval ;
+: print ;
+
+: rep
+ read
+ eval
+ print ;
+
+create buff 128 allot
+
+: read-lines
+ begin
+ ." user> "
+ buff 128 stdin read-line throw
+ while
+ buff swap
+ rep type cr
+ repeat ;
+
+read-lines \ No newline at end of file