Skip to content

Commit c1f3815

Browse files
committed
Straight up inport from STOICAL 1.8.0 by Jonathan Moore Liles
0 parents  commit c1f3815

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+19872
-0
lines changed

COPYING

+340
Large diffs are not rendered by default.

ChangeLog

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2002-05-06 Jonathan M. Liles <wantingwaiting@users.sf.net>
2+
3+
* util/genvim: added syntax folding.
4+
5+
* Makefile.in, util/genvim: generate vim syntax from documentation.
6+
7+
2002-05-05 Jonathan M. Liles <wantingwaiting@users.sf.net>
8+
9+
* kernel.c: fixed call to term_restore
10+
11+
* doc/stoical.1: added man page
12+
13+
* hash.c (hash_next): fixed member descent
14+
15+
* strings.c (interpolate): added mode option
16+
17+
* words.c (compile): run regex's through interpolate mode 1
18+
19+
* util/docex: build one big file instead of many small ones
20+
21+
* debain/: added debian package support
22+
23+
* Makefile.in, src/Makefile.in, config.h.in,
24+
configure.in: Use autoconf
25+
26+
* all: Built and tested on FreeBSD 4.5
27+
28+
2002-05-03 Jonathan M. Liles <wantingwaiting@users.sf.net>
29+
30+
* NEWS: Version .06 released
31+
32+
* words.c: added SEEK
33+
34+
2002-05-02 Jonathan M. Liles <wantingwaiting@users.sf.net>
35+
36+
* words.c: New type checking system.
37+
38+
* kernel.c: No warnings with -Wall.
39+
40+
* kernel.c: Much more informative output on errors.
41+
42+
2002-04-29 Jonathan M. Liles <wantingwaiting@users.sf.net>
43+
44+
* words.c: All flow control is now based on code blocks (clauses).
45+
46+
* debug.c, signal.c: Informative diagnostics displayed on exceptions.
47+
48+
2002-04-23 Jonathan M. Liles <wantingwaiting@users.sf.net>
49+
50+
* hash.c, hash.h,
51+
words.c: Support for dynamically sized, hash based associative arrays.
52+
53+
* doc/words: Documentation now generated from source code.
54+
55+
* vim/: Vim syntax highlighting files included.
56+
57+
* kernel.c: Intelligently accept command line arguments.
58+
59+
* doc/Stoical: Now with -gasp- general documentation!
60+
61+
2002-04-19 Jonathan M. Liles <wantingwaiting@users.sf.net>
62+
63+
* NEWS: Version .02 released.
64+
65+
* dict.c: Better memory management for vocabulary entries.
66+
67+
* words.c: Full POSIX compatible regular expression support.
68+

FEATURES

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
2+
Above and beyond the grace and efficiency of its syntax, STOICAL
3+
provides several additional features that make it a truly powerful
4+
tool in any programmer's arsenal. Among these are:
5+
6+
7+
Extensibility.
8+
9+
This may be something of a buzz word these days, but
10+
Forth like languages have been extensible from their very
11+
beginning. To understand what this means you must first
12+
consider a language that is not extensible. We shall
13+
take C to be an example. Though it is true that you can
14+
define additional functions or procedures in C, you cannot
15+
extend the language itself. The syntax and operators are fixed
16+
and unyielding. In an extensible language, however, all of these
17+
things are liquid, and may be altered at any time. In STOICAL,
18+
the programmer may define his program as a little language
19+
in its own right.
20+
21+
Interactivity.
22+
23+
STOICAL, like its predecessor, is completely interactive.
24+
It incrementally compiles and executes instructions and
25+
definitions as you enter them. This allows for easy testing
26+
and development of applications. And because of its speed you
27+
don't have to suffer for this convenience.
28+
29+
Cooperation
30+
31+
Many people in my circles seem to be of the opinion that all
32+
Reverse Polish languages must, by very definition, also be their
33+
own operating system*. This is foolish. I like my operating system,
34+
and I like other computer languages. Moreover, I like them all to
35+
interact in an intelligent and useful way. It is for this reason that
36+
STOICAL strives to exploit the operating system and environment
37+
in any way that it can.
38+
39+
* - The most notable exception being Jason Evans and his Onyx
40+
extension language.
41+
42+
Networking.
43+
44+
For the past 10 years a large percentage of computer programs have
45+
had to deal with the interconnection of systems in some way.
46+
Currently, nearly every application must deal with the extreme
47+
interconnection known as the Internet. To facilitate this, STOICAL
48+
supports socket based networking in a straight forward, familiar
49+
and empowering fashion.
50+
51+
POSIX Threading.
52+
53+
Obviously, networking isn't of much use without concurrency of
54+
some kind, and threads are the best form of concurrency made
55+
available by the operating system. STOICAL makes handling
56+
multiplicity uncommonly simple.
57+
58+
POSIX Regular Expressions.
59+
60+
STOICAL integrates support for the POSIX Regular Expression
61+
(regex) pattern matching facility, a truly striking feature for a
62+
stack based language. In fact, regex's are more integrated with
63+
STOICAL than they are with languages specially designed for them,
64+
such as Perl.
65+
66+
Associative Arrays (Hash Tables).
67+
68+
This powerful programming tool is overlooked by far too many languages.
69+
Associative arrays are one of those features that most languages never
70+
provide, even though you really must have them to write anything of
71+
consequence. Oddly, almost all modern compilers use associative arrays
72+
internally, to store their symbol table data. In any event, STOICAL
73+
integrates hash table based associative arrays seamlessly with the
74+
language; Another ground breaking feature in the world of RPN.
75+
76+
Passive Garbage Collection.
77+
78+
Many modern, dynamic languages put a great deal of effort
79+
into active, mark and sweep garbage collection algorithms and
80+
implementations. The design of some of these languages makes
81+
this necessary, because the object name space is an infinite
82+
resource. However, in a stack based language the name space
83+
is replaced by a finite store, quite obviously referred to
84+
as 'the stack'. Because this stack can only hold a specific
85+
number of items at any one time, garbage collection becomes
86+
a simple matter of trust. The programmer trusts the language
87+
not to free his memory until a reasonable amount of activity
88+
has taken place on the stack. Garbage collection is implemented
89+
internally as a FIFO stack, which is, unlike the parameter stack,
90+
infinite. However, only the topmost X elements of this stack ever
91+
have actual storage allocated to them. This fits well with
92+
normal usage patterns of the language. If the programmer needs
93+
a dynamic object to remain permanently, he simply does the
94+
obvious thing, and files it into the dictionary.
95+
Currently, nameless, non constant strings are the only dynamically
96+
allocated objects in the language; The dictionary grows and shrinks
97+
dynamically, but it isn't an object, and doesn't require garbage
98+
collection.
99+
100+
Passive Type-checking.
101+
102+
Passive type-checking means that only words which desire type-checking
103+
will incur any performance penalty, and even then the extra computation
104+
is miniscule. The type-checking system also allows word (operator)
105+
overloading. This is why you can use the word + (plus) to add figures,
106+
as well as to concatenate strings.
107+
108+
Floating Point Arithmetic.
109+
110+
Anyone who has used a Forth system in the past knows what a headache
111+
it can be to do floating point calculations. In STOICAL, this is
112+
completely transparent, as floats and integers occupy the same
113+
stack and behave identically.
114+
115+
More.
116+
117+
Of course, it is 4:00 in the morning right now, and I cannot
118+
be expected to remember every exciting little detail.
119+
Just know that you will come to appreciate many new things about
120+
language in time, and likely discover features that even I have
121+
overlooked.
122+
123+

HISTORY

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
STOICAL is a modern adaptation of the classic stack language STOIC. STOIC was
3+
developed circa 1977 by Jonathan M. Sachs while at the Biomedical Engineering
4+
Center for Clinical Instrumentation under the Massachusetts Institute of
5+
Technology Program in Health Sciences and Technology. STOIC was itself preceded
6+
by a language called FORTH, developed circa '68 for the National Radio
7+
Astronomy Observatory in Charlottesville Virginia by Charles H. Moore. Moore,
8+
though clinically insane, has continued to extend his language over the years.
9+
At the time of this writing FORTH is known to him as colorForth; One imagines
10+
that these colors are much like those present in his twisted visions and terror
11+
filled dreams. Sachs, however, is now dabbling in software for the Pocket PC
12+
architecture, and appears to have all but forgotten about STOIC. At one point
13+
in the early '80s, a fellow named Ernest E. Bergmann attempted to reincarnate
14+
STOIC in a language dubbed PISTOL (Portably Implemented STack Oriented
15+
Language). This implementation had its roots in BDS C, and remains something of
16+
an amusement.
17+
18+
This sordid history is further complicated by the fact that the components
19+
of my name, Jonathan and Moore, were attributed to me by my father in honor
20+
of these two men, Sachs and Chuck.
21+
22+
I came to work on STOICAL by way of my quest for the perfect language. You see,
23+
I recently ran across a language called Onyx, developed by Jason Evans. Onyx
24+
has its roots in Forth and PostScript. Jason had never even heard about STOIC,
25+
although his language implements features that are strikingly similar to
26+
those I remembered reading about in the papers that Sachs gave my father. The
27+
source code and documentation for Onyx exceed 10 megabytes in size, and
28+
the runtime is sluggish compared to more simplistic implementations. This
29+
can be attributed to the extra storage and calculation used to support
30+
multi-threaded execution, type-checking and exception recovery. I found this
31+
to be quite divergent from the capabilities, and thereby efficiency of STOIC.
32+
So, I set out to port STOIC to a modern environment and compare it with the
33+
alternatives. This effort soon failed as STOIC's assembly language source is
34+
intrinsically tied to the system for which it was written. So, if Sachs
35+
doesn't care about abstraction, why should I? At this point I could almost
36+
feel the beast of free software rising up inside me. "Go forth! Re-implement
37+
and adapt!", the creature shouted out from within my gut. And hence forth this
38+
creation shall be known to men of earth as STOICAL; And he shall stop times to
39+
reflect on its initial five letters. These five commandments, if you will,
40+
that STOICAL lives up to, and more than that, expands upon. I recite them now:
41+
42+
STack: because of the way she walks.
43+
Oriented: for that hungry gleam in her eyes.
44+
Interactive: because she wears not panties!
45+
Compiler: need I say more!?
46+
47+
Interestingly enough, this brings me back to the point I made previously
48+
about the mental state of one Chuck H. Moore. For reasons that I've yet to
49+
fully appreciate, both Hewlett Packard calculators and RPN computer languages
50+
appear to have an unhealthy effect on the human psyche. Luckily, however,
51+
they also happen to stimulate the pleasure centers of the brain. Take note;
52+
You have been warned, and yet you have also been encouraged.

MANIFEST

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
ChangeLog
2+
COPYING
3+
FEATURES
4+
HISTORY
5+
MANIFEST
6+
Makefile.in
7+
README
8+
TODO
9+
configure
10+
configure.ac
11+
config.h.in
12+
install.sh
13+
doc/Stoical
14+
doc/stoical.1.in
15+
examples/dir
16+
examples/threads
17+
lib/cryptic
18+
lib/def
19+
lib/hash
20+
lib/stoic
21+
src/Makefile.in
22+
src/builtins.h
23+
src/config.h
24+
src/debug.c
25+
src/debug.h
26+
src/dict.c
27+
src/hash.c
28+
src/hash.h
29+
src/help.h
30+
src/kernel.c
31+
src/kernel.h
32+
src/mem.c
33+
src/signal.c
34+
src/string.c
35+
src/term.c
36+
src/words.c
37+
test/Makefile.in
38+
test/array
39+
test/hash
40+
test/test
41+
test/thread
42+
util/docex
43+
util/genvim
44+
vim/filetype.vim
45+
vim/scripts.vim
46+
debian/changelog
47+
debian/README.Debian
48+
debian/control
49+
debian/dirs
50+
debian/info
51+
debian/copyright
52+
debian/docs
53+
debian/menu
54+
debian/postinst
55+
debian/postrm
56+
debian/watch
57+
debian/rules

Makefile

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# Makefile for Stoical.
3+
#
4+
# See src/config.h for build options.
5+
6+
VERS= 0.1.8
7+
META= Makefile
8+
OBJS= kernel.o term.o mem.o hash.o dict.o debug.o string.o signal.o
9+
SRCS= kernel.c term.c dict.c string.c hash.c debug.c mem.c signal.c
10+
PREFIX= /usr/local
11+
NAME = stoical-$(VERS)
12+
LIBROOT= $(PREFIX)/lib/stoical
13+
CFLAGS= -c -DVERSION=\"$(VERS)\" -DLIBROOT=\"$(LIBROOT)\" -Wall -w -O0
14+
LIBS= -lm
15+
16+
all: src/.depend
17+
cd src && $(MAKE)
18+
19+
src/.depend:
20+
@echo Generating dependencies
21+
@cd src && $(CC) -MM $(SRCS) > .depend
22+
23+
doc:
24+
@echo Generating documentation
25+
@./stoical -l lib util/docex src/words.c lib/def doc/words.d
26+
@echo Generating Vim syntax
27+
@mkdir -p vim/syntax
28+
@./stoical -l lib util/genvim doc/words.d >vim/syntax/stoical.vim
29+
@cat doc/words.d/* >doc/words; rm -rf doc/words.d
30+
31+
test:
32+
cd $@ && $(MAKE)
33+
34+
install: all doc
35+
install -s stoical $(PREFIX)/bin
36+
mkdir -p $(LIBROOT); cp -R lib/* $(LIBROOT)
37+
mkdir -p $(PREFIX)/share/doc/stoical
38+
cp -R COPYING README doc/Stoical doc/words $(PREFIX)/share/doc/stoical
39+
cp doc/stoical.1 $(PREFIX)/share/man/man1
40+
41+
clean:
42+
rm -f stoical
43+
cd src && $(MAKE) $@
44+
45+
distclean: clean
46+
rm -f Makefile src/Makefile config.cache config.h config.log
47+
echo -e 'all:\n%:\n\t./configure && $(MAKE) $$@' > Makefile
48+
49+
pkg: distclean
50+
rm -f $(NAME)
51+
ln -sf . $(NAME)
52+
cat MANIFEST | sed 's/^/$(NAME)\//' | xargs tar czvf $(NAME).tar.gz
53+
rm -f $(NAME)
54+
55+
.PHONY: doc test clean
56+
.EXPORT_ALL_VARIABLES:
57+

0 commit comments

Comments
 (0)