- ABORT
- ABORT"
- ABS
- ACCEPT
- ACTION-OF
- AGAIN
- ALIGN
- ALIGNED
- ALLOT
- AND
- BASE
- BEGIN
- BL
- BUFFER:
- [
- [CHAR]
- [COMPILE]
- [']
- CASE
- C,
- CELL+
- CELLS
- C@
- CHAR
- CHAR+
- CHARS
- COMPILE,
- CONSTANT
- COUNT
- CR
- CREATE
- C!
- :
- :NONAME
- ,
- C"
- DECIMAL
- DEFER
- DEFER@
- DEFER!
- DEPTH
- DO
- DOES>
- DROP
- DUP
- /
- /MOD
- .R
- .(
- ."
- ELSE
- EMIT
- ENDCASE
- ENDOF
- ENVIRONMENT?
- ERASE
- EVALUATE
- EXECUTE
- EXIT
- =
- FALSE
- FILL
- FIND
- FM/MOD
- @
- HERE
- HEX
- HOLD
- HOLDS
- I
- IF
- IMMEDIATE
- INVERT
- IS
- J
- KEY
- LEAVE
- LITERAL
- LOOP
- LSHIFT
- MARKER
- MAX
- MIN
- MOD
- MOVE
- M*
- -
- NEGATE
- NIP
- OF
- OR
- OVER
- 1-
- 1+
- PAD
- PARSE-NAME
- PARSE
- PICK
- POSTPONE
- +
- +LOOP
- +!
- QUIT
- RECURSE
- REFILL
- REPEAT
- RESTORE-INPUT
- R@
- ROLL
- ROT
- RSHIFT
- R>
- SAVE-INPUT
- SIGN
- SM/REM
- SOURCE-ID
- SOURCE
- SPACE
- SPACES
- STATE
- SWAP
- ;
- S\"
- S"
- S>D
- !
- THEN
- TO
- TRUE
- TUCK
- TYPE
- '
- *
- */
- */MOD
- 2DROP
- 2DUP
- 2/
- 2@
- 2OVER
- 2R@
- 2R>
- 2SWAP
- 2!
- 2*
- 2>R
- U.R
- UM/MOD
- UM*
- UNLOOP
- UNTIL
- UNUSED
- U.
- U<
- U>
- VALUE
- VARIABLE
- WHILE
- WITHIN
- WORD
- XOR
- 0=
- 0<
- 0>
- 0<>
- \
- .
- <
- >
- <>
- #>
- <#
- #
- #S
- (
- ?DO
- ?DUP
- >BODY
- >IN
- >NUMBER
- >R
6.1.0070 ' tick CORE
Skip leading space delimiters. Parse name delimited by
a space. Find name and return xt, the execution
token for name. An ambiguous condition exists if
name is not found. When interpreting,
' xyz EXECUTE
is equivalent to xyz
.
See:
Rationale:
Many Forth systems use a state-smart tick. Many do not. Forth-2012 follows the usage of Forth 94.
Testing:
ContributeContributions
JohanKotlinski [11] Request for clarification2015-12-25 23:32:43
"An ambiguous condition exists if name is not found. When interpreting, ' xyz EXECUTE
is equivalent to xyz
."
Which of these two statements have precedence? I.e., if xyz is not found, should ' xyz EXECUTE
be equivalent to xyz
or will it cause an ambiguous condition?
ruv [96] Ambiguous condition in case of undefined execution semanticsComment2019-07-16 15:12:55
1. By the definition, an execution token identifies some execution semantics.
2. The specification of this word (i.e. Tick '
) implies that when a word has execution semantics it shall have the interpretation semantics too, and performing its execution semantics in interpretation state shall be identical to performing its interpretation semantics.
3. But this specification does not imply the inverse — that if a word has the interpretation semantics it shall have execution semantics too. For example 123
has the interpretation semantics, but it may not have execution semantics. In such case Tick cannot return any meaningful xt for it.
NB: IIRC in some Forth systems Tick and FIND can return meaningful xt for the numbers (but in any case, such Forth system can be easily implemented).
4. Therefore, an ambiguous condition should exist if '
is applied to a word with undefined execution semantics (i.e. when the standard does not explicitly specify execution semantics). The examples of such words are: dual-semantics words like TO
, S"
, the words with undefined interpretation semantics like IF
, the numbers.
JimPeterson [176] Is Tick Immediate?Request for clarification2021-01-22 02:52:22
I'm confused. Is ' an immediate word or not?
If I do:
: test ' DUP ;
1 test SWAP
Do I get:
( xtD 1 )
where xtD is the execution token of DUP that got swapped with the 1, or do I get:
( 1 xtS xtS )
where xtS is the execution token of SWAP that got duplicated?
The existence of ['] certainly implies that ' is not immediate, and that if you want to have an immediate effect, you should use [']. Maybe that's what the documentation is trying to imply by not having separate "Compilation:" and "Runtime:" sections for this word? Many of the simpler words don't have such sections. Still, it may be better to explicitly state when the parsing and finding occurs... just for the sake of clarity. Maybe add another test to the "Testing:" section?
ruv [346] Eliminating ambiguous conditions for TickRequest for clarification2024-06-20 15:25:45
I'm interested in how we want to define Tick's behavior in edge cases, as part of the general trend of reducing the number of ambiguous conditions.
Undefined word
When a word is not found (regardless of STATE), Tick shall throw an exception -13
("undefined word"). It's obvious.
Undefined interpretation semantics
When interpretation semantics for the word are not defined by the standard, Tick shall do one from the following options:
- return xt for a system-defined behavior (so, an ambiguous condition exists if this xt is executed);
- throw exception
-32
"invalid name argument"; - throw exception
-13
"undefined word" (I think, this option is undesired. Can we exclude it?).
This case is for the words like if
, >r
, exit
, begin
, etc.
Interpretation semantics are defined, but execution semantics undefined
The main question is this: should we allow Tick to throw an exception if interpretation semantics for the word are defined, but execution semantics are not defined?
At the moment, it's for the five standard words: s"
, s\"
, to
, is
, action-of
.
Most systems in this case return xt that, when executed in interpretation state, performs the interpretation semantics for the word. Behavior in compilation state vary from system to system. So, by the fact, an ambiguous condition exists only when this xt is executed in compilation state.
What do you think?