# Taking a shot at Forth ...



## gnemmi (Feb 7, 2009)

Basically ... I just feel like I need to understand what's written in there when I take a look at a *.4th file ..

Now .. I've got the books ... read something .. and I want to start writing something and feeding it to a Forth interpreter(??) to see what actually happens.. now, is there a BSD Forth?

Should I go install gforth? pfe?

Would you guys please throw any pointers?

Thanks a lot for reading 
Regards


----------



## Djn (Feb 7, 2009)

Heh, that's actually a good question - where does the forth interpreter in the bootloader come from? Is it copy/pasted in there, or is there a standalone version somewhere in the base system?


----------



## gnemmi (Feb 7, 2009)

You got it ... and you got it _right_ 
As far as I can tell .. there's no stand alone ...and if it is, it is not to be found under /usr/bin .. :s


----------



## Carpetsmoker (Feb 7, 2009)

It would seem that FreeBSD does not have a general-purpose forth interpreter in the base system, /boot/loader includes a forth interpreter that can only be used by the boot loader (?)

You can use a 3rd party forth interpreter (There are three in ports, lang/ficl-devel, lang/gforth, and lang/pfe-devel)

Relevant bits from loader(8):


```
It provides a scripting language that can be used to automate tasks, do
     pre-configuration or assist in recovery procedures.  This scripting lan-
     guage is roughly divided in two main components.  The smaller one is a
     set of commands designed for direct use by the casual user, called
     "builtin commands" for historical reasons.  The main drive behind these
     commands is user-friendliness.  The bigger component is an ANS Forth com-
     patible Forth interpreter based on FICL, by John Sadler.

[...]

FICL
     FICL is a Forth interpreter written in C, in the form of a forth virtual
     machine library that can be called by C functions and vice versa.

     In loader, each line read interactively is then fed to FICL, which may
     call loader back to execute the builtin words.  The builtin include will
     also feed FICL, one line at a time.

     The words available to FICL can be classified into four groups.  The ANS
     Forth standard words, extra FICL words, extra FreeBSD words, and the
     builtin commands; the latter were already described.  The ANS Forth stan-
     dard words are listed in the STANDARDS section.  The words falling in the
     two other groups are described in the following subsections.
```


----------



## gnemmi (Feb 7, 2009)

Really informative and pretty straight forward info ...

so .. lang/ficl-devel it is then .. 

Thanks for your help Carpetsmoker 

PS: Just in case .. ficl is released under a two clause BSD license  !!


----------

