DEFER: word
FORGET: word
POSTPONE: word
+ SLOT: name
! Classes
GENERIC#: word 1 ! comment
drop ! wrong
MATH: + ( x y -- z ) foldable flushable
- SLOT: name
C: <foo> foo
+ CONSTRUCTOR: <circle> circle ( radius -- obj ) ;
! Private definitions
HOOK: word variable ( stack -- effect )
GENERIC#: word 1 ( stack -- effect )
MATH: + ( x y -- z ) foldable flushable
- SLOT: name
C: <foo> foo
PRIVATE>
SYMBOL: word
SYMBOLS: words ... ;
- C: <foo> foo
-
! Math
1 2 +
{ CHAR: c CHAR: H }
{ CHAR: d CHAR: C }
-! New number literals:
+! Bin
- 0xCAFEBABE
- 0o432
0b10101
+ 0B10101
+
+! Oct
+
+ 0o432
+ 0O1234567
+ 0o1234567
+ 0o7
+
+! Hex
+
+ 0xCAFEBABE
+ 0XCAFEBABE
+ 0x1AB4p30
+
+! Dec
+
1,000
10,000
+
+! Float
+
1e10
-1.5e-5
+
! Weird numbers
1,234+56/78
-1.5e30
1.5e-30
1,000.1,2
- 0XCAFEBABE
- 0x1AB4p30
- 0B10101
- 0O1234567
NAN: CAFE1234 0,. ! third token wrong
0,. ! wrong, next line also wrong
0,.
NAN: ! ff 0xff comment
xCAFE1234 ! wrong
ff ! shouldn't match as a hex number
- 0o7
NAN: 0
drop
NAN: !
NAN:
f,
+ NAN: ALKSJDflKJ ! XXX: should error
! Not numbers
+ ,0.1
+ .
+ -.
1foo
1.5bar
+foo
flushablething
flushable
<PRIVATEfoo
-
"asdf"foo
<< 5 1 + . >> 1
tail?
0.1
-,0.1 ! wrong
10,0.1
1.23
.1
-0.1
-0,1.1
1.
-. ! other
--. ! other
! Numeral comma separator parsing (!: wrong, ~: other):
! int