Dec 082017
A UNIX version of Forth written in C, includes full C source code.
File CFORTH.ZIP from The Programmer’s Corner in
Category UNIX Files
A UNIX version of Forth written in C, includes full C source code.
File Name File Size Zip Size Zip Type
B2L.C 584 347 deflated
CFORTH.MSG 4438 1659 deflated
COMMON.H 5593 2395 deflated
FORTH%LX.H 775 402 deflated
FORTH.C 14189 5195 deflated
FORTH.DIC 19494 7189 deflated
FORTH.H 3158 1351 deflated
FORTH.LEX 3785 1265 deflated
FORTH.LIN 11966 3292 deflated
L2B.C 702 387 deflated
LEX%YY.C 16784 4183 deflated
MAKEFILE 947 397 deflated
NF.C 18610 5824 deflated
PRIMS.C 11279 3562 deflated
PRIMS.H 2593 910 deflated
READ.ME 3840 1722 deflated

Download File CFORTH.ZIP Here

Contents of the READ.ME file

This is posting one of three of a portable FORTH interpreter, written
entirely in C. It has been successfully ported to a VAX 11/60 running
BSD 2.9, to EUNICE version 3 (I think), and the original machine, a VAX
11/780 running BSD 4.2. When I mentioned in net.lang.forth (and elsewhere)
that I was writing this portable FORTH, several people asked that I post
the results of my labors. Well, here they are.

-- Allan Pratt
(after May 7:) [email protected]

[moderator's note: I have had no luck at all getting through
to this address. There was a missing file in the original
distribution "forth.lex.h" which I have reconstructed
(hopefully correctly). - John P. Nelson]

[In order to move these files to an MS-DOS environment several file
names had to be changed. If you are running under UNIX please
changes the following file names:


I haven't tried to modify this to run under MS-DOS, however, the
code looks fairly portable (with the exception of file names).
- Ken Brown ]


Makefilesupposed to bring them all together
b2l.c and b2l*filter to convert block-files into line-files for editing
l2b.c and l2b*filter to convert line-files into block-files for FORTH

common.hThis is a header file with configuration and common information
used by all C source files except lex.yy.c

forth.hHeader file with primitive numbers in it, among other things
forth.csource code for the guts/support functions for the interpreter
prims.hHeader file with macro definitions for primitives
prims.csource code for primitives too complex for macros

The above four files, plus common.h, contribute to the
executable "forth"

nf.csource for the bootstrapper, which interprets the dictionary
and generates an initial memory image for FORTH

forth.lexlex input for lexical analyzer used by nf.c
forth.lex.hheader file used by lex.yy.c and nf.c

lex.yy.clex output, modified (look at the Makefile)

The above four files, plus common.h, contribute to the
executable "nf", the preprocessor.

forth.block*This is the (default) block-file used by FORTH for its
editing- and load-screens

forth.lineThis file usually resembles forth.block, but is in a
(forth.lin)format suitable for editing with emacs or vi: a header
line, followed by sixteen lines of trailing-blank-
truncated, newline-terminated text for each screen.

If one of forth.line and forth.block is out of date with
respect to the other, you can bring it back up to date
with b2l or l2b, above.

forth.dictThis is a human-readable, pseudo-FORTH dictionary which
(forth.dic)nf uses to generate the initial environment. It contains
forward references and no higher structures like DO..LOOP

forth.core*This is one output of nf: it contains the core image for
the FORTH environment, as dictated by common.h and forth.dict

forth.newcore*This is the file for holding core images saved with the (SAVE)
primitive. If FORTH is started with "-c forth.newcore", the
image is restarted right where it left off.*This is another output of nf: it contains a human-readable
dump of the forth environment which nf generated. This can
be compared with the post-mortem dump which FORTH generates
in forth.dump in certain cases.

[Files marked with an '*' are not included - they are created as
the system is installed. Names in parentheses are the names in
this library. - Ken]

 December 8, 2017  Add comments

Leave a Reply