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


Groups > comp.lang.forth > #34776

Re: TclForth Notes: Always Compiling, Forth without STATE

From Wolf Wejgaard <wolf@holonforth.com>
Newsgroups comp.lang.forth
Subject Re: TclForth Notes: Always Compiling, Forth without STATE
Date 2014-12-04 16:54 +0100
Organization Aioe.org NNTP Server
Message-ID <m5q03s$ldc$1@speranza.aioe.org> (permalink)
References <m130qf$lb2$1@speranza.aioe.org> <m13lv0$dod$1@speranza.aioe.org> <D5qsmPs$dkB@7fun.de>

Show all headers | View raw


On 2014-11-30 21:20:00 +0000, Joachim Merkel said:

> ...
> 
> Trying with TclForth V052:
> 
> ok> Compiler [  appendcode \[
> ok> Compiler ]  appendcode "\] "
> ok> : test { -- } [ 1 2 + . ] ." We gaan naar Rome" ;
> ok> test
> 3 ? invalid command name ""
> ok>

Yes, it doesn't work as intended. I found the true solution later (see below).

The TclForth command line also handles compiling words, example:

  ok> 8 1 do I . loop
  1 2 3 4 5 6 7 ok> 
  ok>

TclForth does not interpret the line word by word but compiles the full 
command line
and then executes it. The result is the same.

One question remained, which I tried to solve in the previous post:  If 
the interpreter
compiles the full line, how can it handle the immediate execution of a 
part enclosed
in [ ] brackets for a result that is needed for compiling the rest of the line?

Solution: Compile and execute the bracketed part.

Let me illustrate with examples from the TclForth console:

  ok> 1 [ 2 ] 3
  (2 1 3) ok>

  ok> "first" . "second" . [ "third" . ] "fourth" .
  third first second fourth ok> 
  ok>

During compilation the immediate part is separately compiled and 
executed, and removed
from the script, which is then further compiled and and executed.

TclForth thus works without a STATE variable, which makes me wonder if 
this is a
general solution for a Forth system. After all, classical Forth takes 
great care in
handling and discussing words that depend on a STATE.  So far TclForth 
does fine
without.

----------

I have moved the TclForth systems to GitHub for better version control 
and change
management, and eventual cooperation.

         https://github.com/wolfwejgaard/tclforth

The current version 0.56 includes the compiler update described above.


-----------


> BTW. I like HolonU and it's intensively in use here understanding
> my old PowerBasic-programs again after fine-grain modularizing them.
> Nice Work indeed, I'm very thankful you've shared your work.

:) - Welcome to the club!

> 
> Now I puzzle about tcl/tk over a year and try to understand
> TclForth too. I'm not going to be a script-kid, but deeper
> understanding of this stuff seems valuable to me and makes fun.

What fascinates me: Forth is usually built on a very low or less low 
level language,
mostly assembler or C. You have to create all the useful high-level 
stuff yourself,
although there is by now a large body of solutions to draw on.

Now, if instead you base your Forth on a rich mature interpreter 
language like Tcl as
your native language, you have all the features of classical Forth - 
and much more -
available with a small grab down for whatever you need.  Moreover, with 
Tcl you also
get an inner interpreter ready made for Forth.

And you get a fresh view on classical Forth in comparison. I think it's 
worth it.

The price is some knowledge of Tcl - instead of assembler and C and C 
libraries which
you can duly ignore.

Wolf

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


Thread

TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wolf@holonforth.com> - 2014-10-08 11:40 +0200
  Re: TclForth Notes: Always Compiling, Forth without STATE albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-10-08 11:53 +0000
  Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wolf@holonforth.com> - 2014-10-08 17:41 +0200
    Re: TclForth Notes: Always Compiling, Forth without STATE Joachim Merkel <jm@7fun.de> - 2014-11-30 22:20 +0100
      Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wolf@holonforth.com> - 2014-12-04 16:54 +0100
        Re: TclForth Notes: Always Compiling, Forth without STATE m.a.m.hendrix@tue.nl - 2014-12-05 00:05 -0800
          Re: TclForth Notes: Always Compiling, Forth without STATE "Elizabeth D. Rather" <erather@forth.com> - 2014-12-04 22:47 -1000
            Re: TclForth Notes: Always Compiling, Forth without STATE Bernd Paysan <bernd.paysan@gmx.de> - 2014-12-05 19:04 +0100
              Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wejgaard@gmail.com> - 2015-01-21 02:23 -0800
          Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wolf@holonforth.com> - 2014-12-06 08:53 +0100
            Re: TclForth Notes: Always Compiling, Forth without STATE mhx@iae.nl - 2014-12-06 00:21 -0800
        Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-05 03:16 -0600
          Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wolf@holonforth.com> - 2014-12-06 09:31 +0100
            Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-06 04:16 -0600
            Re: TclForth Notes: Always Compiling, Forth without STATE albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-12-06 10:40 +0000
            Re: TclForth Notes: Always Compiling, Forth without STATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-12-06 12:42 +0000
              Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wejgaard@gmail.com> - 2015-01-21 02:26 -0800
            Re: TclForth Notes: Always Compiling, Forth without STATE Joachim Merkel <jm412@gmx.de> - 2014-12-06 18:11 +0100
              Re: TclForth Notes: Always Compiling, Forth without STATE Joachim Merkel <jm@g7up.de> - 2014-12-06 18:25 +0100
              Re: TclForth Notes: Always Compiling, Forth without STATE Joachim Merkel <jm@7up.de> - 2014-12-06 18:42 +0100
            Re: TclForth Notes: Always Compiling, Forth without STATE mix <mix@test.net> - 2014-12-15 18:55 +0000
              Re: TclForth Notes: Always Compiling, Forth without STATE Coos Haak <chforth@hccnet.nl> - 2014-12-16 01:27 +0100
                Re: TclForth Notes: Always Compiling, Forth without STATE Coos Haak <chforth@hccnet.nl> - 2014-12-16 01:50 +0100
                Re: TclForth Notes: Always Compiling, Forth without STATE mix <mix@test.net> - 2014-12-16 05:04 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-16 04:08 -0600
                Re: TclForth Notes: Always Compiling, Forth without STATE mix <mix@test.net> - 2014-12-16 23:32 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE "Elizabeth D. Rather" <erather@forth.com> - 2014-12-16 14:45 -1000
                Re: TclForth Notes: Always Compiling, Forth without STATE mix <mix@test.net> - 2014-12-17 06:01 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE "Elizabeth D. Rather" <erather@forth.com> - 2014-12-16 22:21 -1000
                Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-17 02:24 -0600
                Re: TclForth Notes: Always Compiling, Forth without STATE "Elizabeth D. Rather" <erather@forth.com> - 2014-12-16 23:07 -1000
                Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-17 08:21 -0600
                Re: TclForth Notes: Always Compiling, Forth without STATE "Elizabeth D. Rather" <erather@forth.com> - 2014-12-17 08:57 -1000
                Re: TclForth Notes: Always Compiling, Forth without STATE JennyB <jennybrien@googlemail.com> - 2014-12-17 04:52 -0800
                Re: TclForth Notes: Always Compiling, Forth without STATE anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-12-17 09:58 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE mix <mix@test.net> - 2014-12-18 04:11 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE mix <mix@test.net> - 2014-12-18 04:16 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-17 02:11 -0600
                Re: TclForth Notes: Always Compiling, Forth without STATE stephen@mpeforth.com (Stephen Pelc) - 2014-12-17 13:17 +0000
                Re: TclForth Notes: Always Compiling, Forth without STATE Mark Wills <markwills1970@gmail.com> - 2014-12-17 06:24 -0800
        Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-05 03:19 -0600
          Re: TclForth Notes: Always Compiling, Forth without STATE Wolf Wejgaard <wolf@holonforth.com> - 2014-12-06 09:31 +0100
            Re: TclForth Notes: Always Compiling, Forth without STATE Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-12-06 04:19 -0600
            Re: TclForth Notes: Always Compiling, Forth without STATE rickman <gnuarm@gmail.com> - 2014-12-08 01:14 -0500
  Re: TclForth Notes: Always Compiling, Forth without STATE the_gavino_himself <visphatesjava@gmail.com> - 2014-12-17 05:42 -0800

csiph-web