Shop Learn
P1 Tachyon 5.7 - How do I create an immediate word? — Parallax Forums

P1 Tachyon 5.7 - How do I create an immediate word?

Christof Eb.Christof Eb. Posts: 520
edited 2021-08-08 07:17 in ForthSpace

P1 Tachyon 5.7 How do I create an immediate word?
I want to create a word that executes immediately during compilation and is not compiled into the new word.
Normally this is done with a IMMEDIATE after the definition of the word.
There seems to be "pre", but I don't know how to use it.

Also I did not find an equivalent of "[" (switch off the compiler temporaryly).
Thanks in advance!
Christof

Comments

  • I want to create a word that executes immediately during compilation and is not compiled into the new word.

    I have a feeling you are trying to test a new word but you do not want it to end up in a a dictionary ? Have I guessed correctly ?

    Because if that's the case, you don't really need that word. You can just type what you need and Tachyon compiles it as you type and when you hit Enter you have your test result.
    Or maybe I am wrong and you really need that immediate word.

  • Hi Maciek,
    I am trying to get a simplified assembler working. I wanted to start the assembler inside of a colon definition. Between ":" and ";" This would be nice, because you could mix Forth and Assembler and use for example If assembler_code THEN.
    Christof

  • ErNaErNa Posts: 1,650

    Is it correct to state the following: Forth is a stack machine, that is, parameters are placed on a stack and then an operator is executed, results are placed on the stack. But sometimes parameters are not available when interaction takes place. So the operator itself must be aware that a parameter is following. That means: the execution of the input stream can not be delayed until an end of string is detected, but the operator itself works as "end of string" and so can fetch the following parameter.
    Tachyon flags such operators with the "pre" tag.

Sign In or Register to comment.