[comp.lang.forth] Help w/ compiler words

aj-mberg@dasys1.UUCP (Micha Berger) (07/27/89)

I have two questions:
	1- I'm trying to define a new type of variable, one that holds
           someone else's CFA. Is there a command that can take a CFA off
           of the stack and execute it?
        2- How do define a compiler word without <BUILDS? I have a DOES>.
           I thought of [COMPILE] :, but in my application it wastes space.

Thanks,
			micha
-- 
					Micha Berger

"Always should [the child of] Adam have awe of G-d in secret and in public,
admit the truth, and speak truth in his heart." 

jax@well.UUCP (Jack J. Woehr) (07/30/89)

In article <10371@dasys1.UUCP> aj-mberg@dasys1.UUCP (Micha Berger) writes:
>
>I have two questions:
>	1- I'm trying to define a new type of variable, one that holds
>           someone else's CFA. Is there a command that can take a CFA off
>           of the stack and execute it?

	Yes. Are you ready for this? It's called EXECUTE.

>        2- How do define a compiler word without <BUILDS? I have a DOES>.
>
	In 79-STANDARD and later use CREATE instead of <BUILDS.

{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
{}                                                                        {}
{} jax@well     ." Sysop, Realtime Control and Forth Board"      FIG      {}
{} jax@chariot  ." (303) 278-0364 3/12/2400 8-n-1 24 hrs."     Chapter    {}
{} JAX on GEnie       ." Tell them JAX sent you!"             Coordinator {}
{}                                                                        {}
{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}

andrew@idacom.UUCP (Andrew Scott) (08/02/89)

In article <10371@dasys1.UUCP>, aj-mberg@dasys1.UUCP (Micha Berger) writes:
> 
> 	1- I'm trying to define a new type of variable, one that holds
>            someone else's CFA. Is there a command that can take a CFA off
>            of the stack and execute it?

The word you're looking for is EXECUTE .  For example:

VARIABLE Vector

: DoVector   Vector @ EXECUTE ;

' ForthWord CFA Vector !
DoVector

In some Forths, there is a word, @EXECUTE, that optimizes the @ EXECUTE
sequence.


>         2- How do define a compiler word without <BUILDS? I have a DOES>.
>            I thought of [COMPILE] :, but in my application it wastes space.

In many Forths (like Forth-83), CREATE is a syunonym for the FIG-Forth <BUILDS.
You might have CREATE on your system.
-- 
Andrew Scott			andrew@idacom
			- or -	{att, watmath, ubc-cs}!alberta!idacom!andrew