[CHAR]

Interpretation:

Interpretation semantics for this word are undefined.

Compilation:

( "<spaces>name" -- )

Skip leading space delimiters. Parse name delimited by a space. Append the run-time semantics given below to the current definition.

Run-time:

( -- char )

Place char, the value of the first character of name, on the stack.

See:

Rationale:

Typical use: : X ... [CHAR] c ... ;

Testing:

T{ : GC1 [CHAR] X     ; -> }T
T{ : GC2 [CHAR] HELLO ; -> }T
T{ GC1 -> 58 }T
T{ GC2 -> 48 }T

ContributeContributions

BerndPaysanavatar of BerndPaysan Reference implementationSuggested reference implementation2015-11-27 23:35:05

: [CHAR] ( "name"<spaces -- ) CHAR POSTPONE LITERAL ; IMMEDIATE

Reply