Implement '\'-style comments
authorJonas Hvid <mail@johv.dk>
Sat, 3 Oct 2020 22:33:07 +0000 (00:33 +0200)
committerJonas Hvid <mail@johv.dk>
Sat, 3 Oct 2020 23:10:57 +0000 (01:10 +0200)
sys.f

diff --git a/sys.f b/sys.f
index 0815e0fe0ca89d729a068e5072a4e8b721635460..38708d1e1a88f479264951bf154c85509583826d 100644 (file)
--- a/sys.f
+++ b/sys.f
@@ -47,7 +47,7 @@ EXIT [
     ELSE
       DROP
     THEN
-  AGAIN ;
+  AGAIN ; ( Yay! We now have comments! )
 
 : UNTIL IMMEDIATE
   ' 0BRANCH ,
@@ -69,6 +69,12 @@ EXIT [
 
 : OVER ( a b -- a b a ) SWAP DUP ROT ;
 
+( An alternative comment syntax. Reads until the end of the line. )
+: \ IMMEDIATE
+  BEGIN
+    KEY
+  10 = UNTIL ;
+
 ( Compile the given string into the current word directly. )
 : STORE-STRING ( str len -- )
   BEGIN