- 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.2.2530 [COMPILE] bracket-compile CORE EXT
Interpretation:
Compilation:
Skip leading space delimiters. Parse name delimited by a space. Find name. If name has other than default compilation semantics, append them to the current definition; otherwise append the execution semantics of name. An ambiguous condition exists if name is not found.
Note:
See:
Rationale:
Testing:
T{ : [c1] [COMPILE] DUP ; IMMEDIATE -> }T
T{ 123 [c1] -> 123 123 }T
With an immediate word
T{ : [c2] [COMPILE] [c1] ; -> }T
T{ 234 [c2] -> 234 234 }T
With special compilation semantics
T{ : [cif] [COMPILE] IF ; IMMEDIATE -> }T
T{ : [c3] [cif] 111 ELSE 222 THEN ; -> }T
T{ -1 [c3] -> 111 }T
T{ 0 [c3] -> 222 }T
ContributeContributions
MitraArdron [173] Obsoleted - by what? Request for clarification2021-01-05 08:24:25
If a word is flagged as obsolescent, shouldn't there be at least a pointer to the prefered alternative(s)?
ruv [192] How to avoid default compilation semantics in the specification for [COMPILE]Comment2021-04-21 09:46:05
The specification for [COMPILE]
is based on the notion of default compilation semantics (this notion implicitly follows from 3.4.3.3 Compilation semantics).
For example:
[COMPILE] IF
is equivalent toPOSTPONE IF
, since IF has non default compilation semantics.[COMPILE] EXIT
is equivalent toEXIT
, since EXIT has default compilation semantics.
A side note. It looks like a user should still know an implementation detail of a word to correctly apply (or not apply) [COMPILE]
to it. Before Forth-94 a user should know whether a word is immediate or not, and since Forth-94 a user should know whether a word has default compilation semantics or not default.
We have a number of words that have default compilation semantics and undefined interpretation semantics in their glossary entries (i.e. specifications). At least for some of them we would want to reword the specification in this regard (see also a comment).
For example, if we rename "Execution" section into "Run-Time" section and introduce "Compilation" section into the glossary entry for EXIT
, then this word formally becomes a word with non default compilation semantics. And then the semantics of [COMPILE] EXIT
phrase is changed.
How we can solve this problem with [COMPILE]
?
Allow to apply [COMPILE]
to the only words that have default compilation semantics?
Or perhaps it's a time to destandardize [COMPILE]
at all?
NB: if EXIT
is implemented as an immediate word in a Forth system, then actually it has non default compilation semantics in this Forth system, and then [COMPILE] EXIT
will produce incorrect code, if [COMPILE]
isn't specially tweaked for such cases.
ruv [195] A final test case for [COMPILE] Suggested Testcase2021-04-28 23:36:43
The test that many systems fail:
T{ :NONAME 1 [COMPILE] EXIT 2 ; EXECUTE -> 1 }T
Definitely, [COMPILE]
should be excluded, but not due to this test fails in some systems. There are other critical points.
See also a discussion/raw message in comp.lang.forth.