Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #39425

Re: COMPILE, and :NONAME

From "Alex McDonald" <blog@rivadpm.com>
Newsgroups comp.lang.forth
Subject Re: COMPILE, and :NONAME
Date 2015-05-29 17:09 +0100
Organization A noiseless patient Spider
Message-ID <mka2tf$dve$1@dont-email.me> (permalink)
References <mk9jkt$j67$1@dont-email.me> <2015May29.152552@mips.complang.tuwien.ac.at> <mk9sli$lep$1@dont-email.me> <2015May29.164556@mips.complang.tuwien.ac.at>

Show all headers | View raw


on 29/05/2015 15:45:56,  wrote:
> "Alex McDonald" <blog@rivadpm.com> writes:
>>Good point. Either way, I was having difficulties finding the compilation
>>semantics of my :NONAMEs
> 
> But COMPILE, does not (and should not, that's what the discussion with
> Bernd Paysan is about) perform compilation semantics. Instead, it
> appends the semantics represented by the xt to the current definition.
> But of course, if you have an intelligent COMPILE, (in contrast to
> Bernd Paysan's "smart COMPILE,") in the sense described in my headers
> page <http://www.complang.tuwien.ac.at/forth/header-ideas.html>,
> nameless words need a COMP field (but not an xt2 field which
> represents the compilation semantics). The page says:
> 
>|You should put the comp field with the code field (if you want to have
>|a comp field); it is needed for unnamed words, too.
>|
>|This gives us:
>|
>|link field
>|name field
>|xt2 field
>|xt1 field
>|
>|comp field
>|code field  <-- cfa (xt1)
>|parameter field (body)
> 
> This is for a separate-header organization, where the blank line
> indicates the separation of the parts (which may be in totally
> different places).
> 
> - anton

That's what I have, slightly modified. 

 lfield: head.ct    \ [ ' compile,   ] <-+ or execute for immediate
 lfield: head.xtptr \ [ xt ptr field ]   | xt pointer
lfield: : head.comp \ [ ' xt-call, ] | how to compile, normally a call

The compilation token is followed by HEAD.COMP (the comp field), and an
XT backpointer points at the compilation token. I now point all :NONAMEs
at a dummy compilation token

0 , 0 , ' xt-call, 

and COMPILE, does 

: >ct    ( xt -- ct ) ( move from the XT to the compilation token) ;
: compile, ( xt -- ) dup >ct head.comp @ execute ;

The HEAD.CT and HEAD.XTPTR fields are irrelevant as only NAME>COMPILE
does a 2@ on HEAD.CT; and :NONAMEs have no name.

I'd managed to bork :NONAME during an attempt to use it for quotations.
So it's fixed for :NONAME, but this:

: named ( -- xt ) [: 1 2 3 ;] ; constant x

still needs work; X isn't COMPILE,able yet as there's no backpointer.
Should be fixable though.



Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 12:48 +0100
  Re: COMPILE, and :NONAME Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-05-29 14:15 +0100
    Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 15:23 +0100
  Re: COMPILE, and :NONAME anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 13:25 +0000
    Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 15:22 +0100
      Re: COMPILE, and :NONAME anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 14:45 +0000
        Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 17:09 +0100
          Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 17:13 +0100
          Re: COMPILE, and :NONAME anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 17:21 +0000
            Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 19:36 +0100
        Re: COMPILE, and :NONAME Bernd Paysan <bernd.paysan@gmx.de> - 2015-05-29 22:47 +0200
          Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 23:23 +0100
            Re: COMPILE, and :NONAME Bernd Paysan <bernd.paysan@gmx.de> - 2015-05-30 02:03 +0200
              Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-30 20:58 +0100
            Re: COMPILE, and :NONAME anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-30 11:56 +0000
              Re: COMPILE, and :NONAME albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-05-30 13:34 +0000
              Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-05-30 20:54 +0100
                Re: COMPILE, and :NONAME foxaudioresearch@gmail.com - 2015-06-01 17:34 -0700
                Re: COMPILE, and :NONAME "Alex McDonald" <blog@rivadpm.com> - 2015-06-02 15:54 +0100
              Re: COMPILE, and :NONAME Bernd Paysan <bernd.paysan@gmx.de> - 2015-05-30 23:45 +0200

csiph-web