Help on starting with Forth

  • Follow


Hi

I'm looking for some help with a few questions on Forth. I've had a browse 
around and looked at the FAQ but still have some questions.

I am not a complete beginner as I used Forth back in the 80's on a BBC 
micro, MAC and some embedded systems. I have a little project in mind and I 
am fed up with Visual Basic so I thought I would relearn Forth. I grabbed a 
copy of Win32Forth and have that up and running on my PC.

1) Is there a simple explanation anywhere of how to get from typing at the 
console, to writing my own first program. ie setting up a project with 
directories, paths etc., and getting as far as the "Hello World" output in 
a window using my own application? 

I have looked at the hello.f example that came with Win32Forth, but it 
looks like a steep learning curve to even get to that stage. (If I have to 
just work through that line by line so be it)

There is a tantalising line in the Win32Forth documentation "Your First 
Forth Program", but there is no link behind it.


2) I found some useful source examples that could point me in the right 
direction for my project, but they are in kforth. Is there any point in 
trying to get them to run under Win32Forth or would it be more sensible to 
start from scratch? I don't want to get too confused between the different 
versions of Forth out there.

I'm sure more question will come up, but any help on the above would be 
much appreciated. Thanks in advance.

Martin
0
Reply nospam9039 (9) 11/12/2004 6:47:42 PM

In article <Xns959FBF35A71A3martinwilliamsdurkin@130.133.1.4>,
 Martin Durkin <nospam@williamsdurkin.co.uk> wrote:

> 1) Is there a simple explanation anywhere of how to get from typing at the 
> console, to writing my own first program. ie setting up a project with 
> directories, paths etc., and getting as far as the "Hello World" output in 
> a window using my own application? 

This is usually operating system dependent, not Forth dependent.

 
> I have looked at the hello.f example that came with Win32Forth, but it 
> looks like a steep learning curve to even get to that stage. (If I have to 
> just work through that line by line so be it)
> 
> There is a tantalising line in the Win32Forth documentation "Your First 
> Forth Program", but there is no link behind it.

I don't know much about Windows programming as I do most everything on a 
Macintosh.  There are no Forth standards for using a windowing GUI type 
OS.  But I would think that just throwing up a window and displaying 
"Hello World" shouldn't be too difficult in any Forth that has been 
extended to work in harmony with its platform OS.

For example, here's one way to do it on the Forth I use.
When creating the turnkey application one simply specifies the word "go" 
as the startup word.  Of course this application will have no menus or 
anything, but it will throw up a window with the ubiquitous phrase.  A 
mouse click in the close box will terminate the program.  I suspect it 
is no more difficult in Windows.

Regards,

-Doug


:class helloWin super{ window }

:m draw:  50 50 MoveTo ." Hello World" ;m

:m close: bye ;m

;class

helloWin w

: go
  test: w ;
0
Reply dhoffman (234) 11/12/2004 11:04:57 PM


"Martin Durkin" <nospam@williamsdurkin.co.uk> wrote in message
news:Xns959FBF35A71A3martinwilliamsdurkin@130.133.1.4...
> Hi
>
> I'm looking for some help with a few questions on Forth. I've had a browse
> around and looked at the FAQ but still have some questions.
>
> I am not a complete beginner as I used Forth back in the 80's on a BBC
> micro, MAC and some embedded systems. I have a little project in mind and
I
> am fed up with Visual Basic so I thought I would relearn Forth. I grabbed
a
> copy of Win32Forth and have that up and running on my PC.
>
> 1) Is there a simple explanation anywhere of how to get from typing at the
> console, to writing my own first program. ie setting up a project with
> directories, paths etc., and getting as far as the "Hello World" output in
> a window using my own application?
>
> I have looked at the hello.f example that came with Win32Forth, but it
> looks like a steep learning curve to even get to that stage. (If I have to
> just work through that line by line so be it)
>
> There is a tantalising line in the Win32Forth documentation "Your First
> Forth Program", but there is no link behind it.

Can't help you with Win32Forth, but our SwiftForth (free evaluation copy on
our web site) includes extensive documentation (2 manuals, one on generic
Forth and one on SwiftForth itself) and lots of examples.  We also offer a
book called Forth Application Techniques that is a tutorial with a lot of
Forth info and problems to give you good practice (it'll work with
Win32Forth, although it doesn't cover its Windows features).  See
www.forth.com.

Cheers,
Elizabeth


-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310-491-3356
5155 W. Rosecrans Ave. #1018  Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================


0
Reply erather (2080) 11/12/2004 11:18:20 PM

"Martin Durkin" <nospam@williamsdurkin.co.uk> wrote in message
news:Xns959FBF35A71A3martinwilliamsdurkin@130.133.1.4...
> Hi
>
> I'm looking for some help with a few questions on Forth. I've had a browse
> around and looked at the FAQ but still have some questions.
>
> I am not a complete beginner as I used Forth back in the 80's on a BBC
> micro, MAC and some embedded systems. I have a little project in mind and
I
> am fed up with Visual Basic so I thought I would relearn Forth. I grabbed
a
> copy of Win32Forth and have that up and running on my PC.
>
> 1) Is there a simple explanation anywhere of how to get from typing at the
> console, to writing my own first program. ie setting up a project with
> directories, paths etc., and getting as far as the "Hello World" output in
> a window using my own application?
>
> I have looked at the hello.f example that came with Win32Forth, but it
> looks like a steep learning curve to even get to that stage. (If I have to
> just work through that line by line so be it)
>
> There is a tantalising line in the Win32Forth documentation "Your First
> Forth Program", but there is no link behind it.
>
>
> 2) I found some useful source examples that could point me in the right
> direction for my project, but they are in kforth. Is there any point in
> trying to get them to run under Win32Forth or would it be more sensible to
> start from scratch? I don't want to get too confused between the different
> versions of Forth out there.
>
> I'm sure more question will come up, but any help on the above would be
> much appreciated. Thanks in advance.
>
> Martin

Join http://groups.yahoo.com/group/win32forth and we'll help you with
Win32Forth. The latest version has got lots more documentation an sample
code.

-- 
Regards
Alex McDonald


0
Reply alex_mcd (751) 11/13/2004 12:15:21 AM

Martin Durkin <nospam@williamsdurkin.co.uk> wrote in message news:<Xns959FBF35A71A3martinwilliamsdurkin@130.133.1.4>...
> Hi

Hi :-)  

> 1) Is there a simple explanation anywhere of how to get from typing at the 
> console, to writing my own first program. ie setting up a project with 
> directories, paths etc., and getting as far as the "Hello World" output in 
> a window using my own application? 

Have you seen the excellent Leo Brodie books, Martin?
"Starting Forth" will be a great refresher for you and IT is on line.

http://www.amresearch.com/starting_forth/

Also, Leo's book, "Thinking Forth", would make a great follow up and
has just recently been released free to the public as a pdf.

http://thinking-forth.sourceforge.net/thinking-forth.pdf
 
> I have looked at the hello.f example that came with Win32Forth, but it 
> looks like a steep learning curve to even get to that stage. (If I have to 
> just work through that line by line so be it)

IMHO -- ignore win32forth for a while. Try gforth before win32forth.
Keep win32forth for the help file and to try things out in the
excellent interpreter and fine editor. I was able to get started in
gforth a lot quicker, but that just might be me. :-)

> There is a tantalising line in the Win32Forth documentation "Your First 
> Forth Program", but there is no link behind it.

Such is the Forth world of information. Make a point to save what ever
you identify as important for you to know, you may never find it
again.
 
 
> 2) I found some useful source examples that could point me in the right 
> direction for my project, but they are in kforth. Is there any point in 
> trying to get them to run under Win32Forth or would it be more sensible to 
> start from scratch? I don't want to get too confused between the different 
> versions of Forth out there.

Chuck has said in the past that it makes no sense to port code. I
would take the example -- and not let what I didn't quite understand
stop me. In forth you can re-invent anything you don't understand in
someone else's code. And use the groups [and|or] IRC as resources.
 
> I'm sure more question will come up, but any help on the above would be 
> much appreciated. Thanks in advance.
 
Nice to meet you Martin :-)

> Martin

Regards.
Ray St. Marie Ray dot StMarie At gmail dot com.
0
Reply ray.stmarie (61) 11/13/2004 6:46:33 AM

Doug Hoffman <dhoffman@journey.com> writes Re: Help on starting with Forth
[..]
> For example, here's one way to do it on the Forth I use.
> When creating the turnkey application one simply specifies the word "go" 
> as the startup word.  Of course this application will have no menus or 
> anything, but it will throw up a window with the ubiquitous phrase.  A 
> mouse click in the close box will terminate the program.  I suspect it 
> is no more difficult in Windows.
[..]

E.g. in iForth:

---
( * LANGUAGE    : ANS Forth
  * PROJECT     : Forth Environments
  * DESCRIPTION : Testing the GUI extensions available from WIN32
  * CATEGORY    : Example code
  * AUTHOR      : Marcel Hendrix, May 9, 1998
  * LAST CHANGE : Marcel Hendrix, May 9, 1998
  * )

	NEEDS -dialogs

\ Simple Messagebox-based Application using the iForth windowing layer.
: HELLO ( -- ) 
	S" Hello World!"  
	S" iForth"  
	W: MB_SETFOREGROUND  W: MB_OK  OR  
	MSGBOX ;

: .ABOUT CR ." Type HELLO <Enter> to execute the application." ; .ABOUT 
---

The problem is of course not in writing this simple code, but in knowing
that this simple code is all what you need.

-marcel

0
Reply mhx (2133) 11/13/2004 7:44:50 AM

mhx@iae.nl (Marcel Hendrix) wrote in news:99791510123563@frunobulax.edu:

snip example

> 
> The problem is of course not in writing this simple code, but in
> knowing that this simple code is all what you need.
> 

Exactly!
0
Reply nospam9039 (9) 11/13/2004 10:37:34 AM

ray.stmarie@gmail.com (Raymond A. St. Marie) wrote in
news:7b23726.0411122246.2a8c55c3@posting.google.com: 

snip

> Have you seen the excellent Leo Brodie books, Martin?
> "Starting Forth" will be a great refresher for you and IT is on line.
> 
> http://www.amresearch.com/starting_forth/
> 

Yes, thanks. I skimmed that and as you said a great refresher.

> Also, Leo's book, "Thinking Forth", would make a great follow up and
> has just recently been released free to the public as a pdf.
> 
> http://thinking-forth.sourceforge.net/thinking-forth.pdf

Added to the list of reading :-)


> 
>> There is a tantalising line in the Win32Forth documentation "Your
>> First Forth Program", but there is no link behind it.
> 
> Such is the Forth world of information. Make a point to save what ever
> you identify as important for you to know, you may never find it
> again.

I've already experienced that.

>  
>  
>  
> Nice to meet you Martin :-)
> 
> Regards.
> Ray St. Marie Ray dot StMarie At gmail dot com.

Thanks for the pointers.
0
Reply nospam9039 (9) 11/13/2004 10:43:03 AM

"Alex McDonald" <alex_mcd@btopenworld.com> wrote in
news:cn3jmo$ec8$1@titan.btinternet.com: 

> 
> 
> Join http://groups.yahoo.com/group/win32forth and we'll help you with
> Win32Forth. The latest version has got lots more documentation an
> sample code.
> 

will do.
0
Reply nospam9039 (9) 11/13/2004 10:43:37 AM

"Raymond A. St. Marie" <ray.stmarie@gmail.com> wrote in message
news:7b23726.0411122246.2a8c55c3@posting.google.com...
> Martin Durkin <nospam@williamsdurkin.co.uk> wrote in message
news:<Xns959FBF35A71A3martinwilliamsdurkin@130.133.1.4>...
> > Hi
>
> Hi :-)
>
> > 1) Is there a simple explanation anywhere of how to get from typing at
the
> > console, to writing my own first program. ie setting up a project with
> > directories, paths etc., and getting as far as the "Hello World" output
in
> > a window using my own application?
>
> Have you seen the excellent Leo Brodie books, Martin?
> "Starting Forth" will be a great refresher for you and IT is on line.
>
> http://www.amresearch.com/starting_forth/
>
> Also, Leo's book, "Thinking Forth", would make a great follow up and
> has just recently been released free to the public as a pdf.
>
> http://thinking-forth.sourceforge.net/thinking-forth.pdf
>

Good advice;

> > I have looked at the hello.f example that came with Win32Forth, but it
> > looks like a steep learning curve to even get to that stage. (If I have
to
> > just work through that line by line so be it)
>
> IMHO -- ignore win32forth for a while. Try gforth before win32forth.
> Keep win32forth for the help file and to try things out in the
> excellent interpreter and fine editor. I was able to get started in
> gforth a lot quicker, but that just might be me. :-)
>

....but why "ignore win32forth for a while"? What put you off? Have you
looked at the later version 6.08 at
http://sourceforge.net/project/showfiles.php?group_id=55294? Or the
Win32Forth group at http://groups.yahoo.com/group/win32forth? Or the group's
site maintained by Dirk Busch at www.win32forth.org?

There have been (in my eyes anyhow) lots of improvements to W32F to provide
a better learning Forth experience. We're close to distributing the next
release before the end of the year with more documentation and an even
better editor (see http://www.win32forth.org/downloads/w32f60913.exe for
6.09.13). I'm interested in any comments you may have.

===snipped

-- 
Regards
Alex McDonald


0
Reply alex_mcd (751) 11/13/2004 11:24:53 AM

Raymond A. St. Marie wrote:
> Also, Leo's book, "Thinking Forth", would make a great follow up and
> has just recently been released free to the public as a pdf.
> 
> http://thinking-forth.sourceforge.net/thinking-forth.pdf

Wait with public announcements, we are not finished.


-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/
0
Reply bernd.paysan (2408) 11/13/2004 4:41:02 PM

"Elizabeth D. Rather" <erather@forth.com> wrote in
news:1100375032.CKn/092D4gX7zOrLsk+qFg@teranews: 

> 
> Can't help you with Win32Forth, but our SwiftForth (free evaluation
> copy on our web site) includes extensive documentation (2 manuals, one
> on generic Forth and one on SwiftForth itself) and lots of examples. 
> We also offer a book called Forth Application Techniques that is a
> tutorial with a lot of Forth info and problems to give you good
> practice (it'll work with Win32Forth, although it doesn't cover its
> Windows features).  See www.forth.com.
> 
thanks Elizabeth, and everyone else. What a friendly newsgroup. Reminds me 
of the good old days when most of usenet was civilized:-)

I think Marcel summed up my problem perfectly in his reply, when he said, 
"The problem is of course not in writing this simple code, but in knowing
that this simple code is all what you need."

I guess there is no substitute for a bit of hard work and study. 

regards
Martin
0
Reply nospam9039 (9) 11/13/2004 8:56:06 PM

"Elizabeth D. Rather" <erather@forth.com> wrote in message 
news:1100375032.CKn/092D4gX7zOrLsk+qFg@teranews...
>
> Can't help you with Win32Forth, but our SwiftForth (free evaluation copy 
> on
> our web site) includes extensive documentation (2 manuals, one on generic
> Forth and one on SwiftForth itself) and lots of examples.  We also offer a
> book called Forth Application Techniques that is a tutorial with a lot of
> Forth info and problems to give you good practice (it'll work with
> Win32Forth, although it doesn't cover its Windows features).  See
> www.forth.com.
>
> Cheers,
> Elizabeth
>
>
<plug>And may I say these manual are quite a charm to read.  Clear, I 
actually have the impression that I'm learning Forth :-).  </plug>

Seriously, they are great manuals, even for a beginner like you and me.  At 
least to me, everything I've been reading is quite clear.

Steph 


0
Reply stephane.richard (354) 11/13/2004 9:28:15 PM

On 13 Nov 2004 20:56:06 GMT,
Martin Durkin <nospam@williamsdurkin.co.uk> wrote:
>
> I think Marcel summed up my problem perfectly in his reply, when he said, 
> "The problem is of course not in writing this simple code, but in knowing
> that this simple code is all what you need."
>

In this vein, you might take a look at RetroForth, too.
It is very small but versatile, runs on many x86-based platforms.

Right now I used it to create verbose XSL Formatting Objects (22k)
from a relatively compact description (4k) with a whopping 6k executable
:-9

Have fun,
s.
0
Reply s7868 (261) 11/14/2004 12:45:05 AM

"Alex McDonald" <alex_mcd@btopenworld.com> wrote in message news:<cn4qu5$3ce$1@titan.btinternet.com>...
> "Raymond A. St. Marie" <ray.stmarie@gmail.com> wrote in message
> news:7b23726.0411122246.2a8c55c3@posting.google.com...> Good advice;
> 
> > > I have looked at the hello.f example that came with Win32Forth, but it
> > > looks like a steep learning curve to even get to that stage. (If I have
>  to
> > > just work through that line by line so be it)
> >
> > IMHO -- ignore win32forth for a while. Try gforth before win32forth.
> > Keep win32forth for the help file and to try things out in the
> > excellent interpreter and fine editor. I was able to get started in
> > gforth a lot quicker, but that just might be me. :-)
> >
> 
> ...but why "ignore win32forth for a while"? What put you off? Have you
> looked at the later version 6.08 at
> http://sourceforge.net/project/showfiles.php?group_id=55294? Or the
> Win32Forth group at http://groups.yahoo.com/group/win32forth? Or the group's
> site maintained by Dirk Busch at www.win32forth.org?
> 
> There have been (in my eyes anyhow) lots of improvements to W32F to provide
> a better learning Forth experience. We're close to distributing the next
> release before the end of the year with more documentation and an even
> better editor (see http://www.win32forth.org/downloads/w32f60913.exe for
> 6.09.13). I'm interested in any comments you may have.
> 
> ===snipped

Because, I don't know how to take my own advice! :-) 

Your absolutely rigtht, Alex. 
Win32Forth( 4.2Build0671) and MVP (just the free stuff), were really
the two forth's that I relied on to get started -- to be quite honest.

I guess my statement draws more from the fact that I had found gforth
and Starting Forth at the same time. After reading "Starting" I was
able to feel more comfortable writing my first full featured forth
program, a script that turns (most any) forth interpreter into a text
based chess game, in gforth. ( no ai yet ).

I tested it in Win32forth and it works fine. 

Personnaly, I think it was the fact that win32forth *seems* so wide
open that it has the appearance of being as vast as the environment it
was written for. I was a bit intimidated by it all.

The gforth environment, while most likely just as vast, for some
reason "felt" more reassuring to me.

I know that it's time for me to *take the plunge* into forth's Windows
environment if i want to be competent on my "Home" os.

So ... see ya soon in the mailing list and on irc. :-)
And thank you for the personal invitation. 

Ray
Ray dot StMarie AT gmail Dot com
0
Reply ray.stmarie (61) 11/14/2004 4:26:05 AM

Martin Durkin wrote:
> 
> Hi
> 
> I'm looking for some help with a few questions on Forth. I've had a browse
> around and looked at the FAQ but still have some questions.
> 
> I am not a complete beginner as I used Forth back in the 80's on a BBC
> micro, MAC and some embedded systems. I have a little project in mind and I
> am fed up with Visual Basic so I thought I would relearn Forth. I grabbed a
> copy of Win32Forth and have that up and running on my PC.
> 
> 1) Is there a simple explanation anywhere of how to get from typing at the
> console, to writing my own first program. ie setting up a project with
> directories, paths etc., and getting as far as the "Hello World" output in
> a window using my own application?
> 
> I have looked at the hello.f example that came with Win32Forth, but it
> looks like a steep learning curve to even get to that stage. (If I have to
> just work through that line by line so be it)
> 
> There is a tantalising line in the Win32Forth documentation "Your First
> Forth Program", but there is no link behind it.
> 
> 2) I found some useful source examples that could point me in the right
> direction for my project, but they are in kforth. Is there any point in
> trying to get them to run under Win32Forth or would it be more sensible to
> start from scratch? I don't want to get too confused between the different
> versions of Forth out there.
> 
> I'm sure more question will come up, but any help on the above would be
> much appreciated. Thanks in advance.
> 
> Martin

   http://Galileo.phys.Virginia.EDU/classes/551.jvn.fall01/primer.htm


-- 
Julian V. Noble
Professor Emeritus of Physics
jvn@lessspamformother.virginia.edu
    ^^^^^^^^^^^^^^^^^^
http://galileo.phys.virginia.edu/~jvn/

   "For there was never yet philosopher that could endure the 
    toothache patiently."  

        -- Wm. Shakespeare, Much Ado about Nothing. Act v. Sc. 1.
0
Reply jvn (707) 11/16/2004 8:01:36 PM

If you don't need buttons and windows (you say you do...), but e.g. want 
to process a text file or create some data patterns for tests, then 
Forth can be used "old style", i.e. in the console or shell of your OS.

Take e.g. gforth. Hello World looks like this:
: HW
    CR ." Hello World" ;
HW

You can make that the boot routine of a Forth-image to be saved, but in 
most cases, you are done.

If you write the three lines into a file, you can (on Windows XP) 
double-click that file and will have that program execute.

In many cases, this is all you need.

Best regards,
    Daniel

Martin Durkin schrieb:
> Hi
> 
> I'm looking for some help with a few questions on Forth. I've had a browse 
> around and looked at the FAQ but still have some questions.
> 
> I am not a complete beginner as I used Forth back in the 80's on a BBC 
> micro, MAC and some embedded systems.

> 1) Is there a simple explanation anywhere of how to get from typing at the 
> console, to writing my own first program. ie setting up a project with 
> directories, paths etc., and getting as far as the "Hello World" output in 
> a window using my own application? 

0
Reply ciesinger (71) 11/16/2004 11:26:26 PM

Doug Hoffman <dhoffman@journey.com> wrote in message news:<dhoffman-1BBEC2.18045712112004@news.chatlink.com>...

> I don't know much about Windows programming 

Obviously no one should pay attention to this guys messages as he
admits to not knowing much about programming.
0
Reply starsupernova (10) 11/27/2004 12:51:33 AM

Chris wrote:
>
>
>Doug Hoffman <dhoffman@journey.com> wrote in message 
news:<dhoffman-1BBEC2.18045712112004@news.chatlink.com>...
>
>> I don't know much about Windows programming 
>
>Obviously no one should pay attention to this guys messages as he
>admits to not knowing much about programming.

I choose instead to not pay attention to you, on the grounds 
that you are to stupid to figure out the difference between 
not knowing  much about Windows programming and  not knowing
much about programming.


0
Reply Guy 11/27/2004 4:40:39 AM

18 Replies
33 Views

(page loaded in 0.227 seconds)

Similiar Articles:


















7/10/2012 9:03:07 AM


Reply: