aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/examples/rec-name.frt
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/examples/rec-name.frt')
-rw-r--r--amforth-6.5/examples/rec-name.frt18
1 files changed, 18 insertions, 0 deletions
diff --git a/amforth-6.5/examples/rec-name.frt b/amforth-6.5/examples/rec-name.frt
new file mode 100644
index 0000000..3957133
--- /dev/null
+++ b/amforth-6.5/examples/rec-name.frt
@@ -0,0 +1,18 @@
+
+\ #require recognizer.frt
+\ #require find-name.frt
+
+\ from forth 2012
+:noname name>interpret execute ;
+:noname name>compile execute ;
+:noname postpone literal ;
+recognizer: r:name
+
+\ the parsing word
+: rec:name ( addr len -- nt r:name | r:fail)
+ find-name ?dup
+ if r:name else r:fail then
+;
+
+\ replace rec:word with rec:name
+\ everthing else should work as before