6.1.2520 [CHAR] bracket-char CORE

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 [4] Reference implementationSuggested reference implementation2015-11-27 23:35:05

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

Reply New Version

NieDzejkobavatar of NieDzejkob [45] Suggested reference implementationSuggested reference implementation2018-01-06 18:18:19

: [CHAR] IMMEDIATE CHAR POSTPONE LITERAL ;

AntonErtlavatar of AntonErtl

IMMEDIATE itself is not immediate, so Bernd Paysan's reference implementation is correct, and it contains a stack effect comment.

NieDzejkobavatar of NieDzejkob

Sorry, I could've sworn the previous implementation isn't there. Please ignore.

Reply New Version