[<<][staapl][>>][..]
Wed Jun 6 08:32:04 EDT 2012

Inlining symbolic constants

There's a way to do macros.

   : foo [ 1 2 3 ] i 

But I'm not sure if functions will work.  I have been playing with
this before, but I don't remember.

There's also this:

   : foo make-label [ 1 ] compile-macro 2 ;

So it should be enough to dup it and compile a call using cw.  ccm =
compile and call macro.

   : foo [ 1 ] make-label dup >m swap compile-macro m> cw ;

Or factored out

   macro
   : ccm make-label dup >m swap compile-macro m> cw ;
   forth
   : foo [ 1 ] ccm ;

I've added it to the compiler as compile-call-macro.  This allows:

   : _kb [ ` kb fbin; ] compile-call-macro fcmd ;

Some refactoring is necessary.  compile-macro compiles exit which we
don't want, and it might be simpler to allow for macro wrapping and
composition to be explicit.

Works.



[Reply][About]
[<<][staapl][>>][..]