Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#######
#
# E-scripts on RubyForth and on its ports.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/rubyforth.e>
#           or at <http://angg.twu.net/e/rubyforth.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.rubyforth»		(to "rubyforth")
# «.rubyforth-uploading»  (to "rubyforth-uploading")
# «.rubyforth-angg»	(to "rubyforth-angg")
# «.rubyforth-demos»	(to "rubyforth-demos")
# «.lrstrip»		(to "lrstrip")
# «.luaforth»		(to "luaforth")
# «.duoforth»		(to "duoforth")
# «.dflua»		(to "dflua")
# «.zbforth»		(to "zbforth")




#####
#
# RubyForth: using
# 2011nov16
#
#####

# «rubyforth»  (to ".rubyforth")
# (find-angg ".emacs" "rubyforth")
# (find-angg "rubyforth/")
# (find-angg "rubyforth/README.too")
# http://angg.twu.net/rubyforth/
# http://angg.twu.net/rubyforth/README.too.html
# http://angg.twu.net/rubyforth/rubyforth-0.24.tar.gz
# http://angg.twu.net/rubyforth/blocks.tar.gz
# http://rubyforth.sourceforge.net/
# http://rubyforth.sourceforge.net/blocks.tar.gz
# http://rubyforth.sourceforge.net/rubyforth-0.24.tar.gz
#*
rm -Rfv ~/usrc/rubyforth/
tar -C  ~/usrc/ -xvzf \
  $S/http/rubyforth.sourceforge.net/rubyforth-0.24.tar.gz
cd      ~/usrc/rubyforth/

#*
* (eepitch-rubyforth)
* (eepitch-kill)
* (eepitch-rubyforth)
1 2 + .

see nip
see r@
see rot
: .bool ( f -- ) if ." True!" else ." False!" then ;
-1 .bool
0 .bool
see .bool
defer foo
' words is foo
foo
' .s is foo
foo

prim pwd push(Dir.pwd)
: .pwd pwd . ;
.pwd

\ prim chdir Dir.chdir(pop) 
\ : cd bl parse chdir ;
\ " /usr" chdir
\ cd /tmp

\ prim (ls) system("ls " + pop)
\ : ls 0 parse (ls) ;
\ ls -l
\ ls -l e*

include tools/system.fs
system ls
ls
ls *.rb

\ (find-rubyforthfile "")
\ (find-rubyforthgrep "grep -nH -e prim *")




# (find-angg "rubyforth/README.too")





\ ====================================================================
\     Marc's implementation of a Categorial/Type Theory Language
\ ====================================================================

\ --[ Globals ]-------------------------------------------------------

variable word

\ --[ Vocabularies ]--------------------------------------------------

vocab: atoms
vocab: connectives

\ --[ Lookup ]--------------------------------------------------------

prim local-xt? push(local_xt(pop))

: atoms-xt       ( word$ -- xt ) atoms expose local-xt? shield ;
: connectives-xt ( word$ -- xt ) connectives expose local-xt? shield ;

: in-atoms?       ( word$ -- f ) atoms-xt 0 > ;
: in-connectives? ( word$ -- f ) connectives-xt 0 > ;

: atom?       ( -- f ) word @ in-atoms? ;
: connective? ( -- f ) word @ in-connectives? ;

\ --[ Printing ]------------------------------------------------------

: _()_   ( str1$       -- str2$ ) " (" swap + " )" + ;
: _|->_  ( str1$ str2$ -- str3$ ) swap " |->" + swap + ;
: _=>_   ( str1$ str2$ -- str3$ ) swap " |=>" + swap + ;

\ --[ Toplevel ]------------------------------------------------------

prim die puts " (returning to toplevel...)" ; return_to_toplevel

: getword ( -- ) parse-word word ! ;

: getname ( -- str$ )
    getword
    atom? if word @ else
	connective? if word @ connectives-xt execute else
	    word @ . ." <- not an atom or connective" die then then ;

\ --[ Connectives ]---------------------------------------------------

connectives expose

: ()  ( -- str$ ) getname _()_ ;
: |-> ( -- str$ ) getname getname _|->_ ;
: =>  ( -- str$ ) getname getname _=>_  ;

shield

\ --[ Atoms ]---------------------------------------------------------

atoms expose

: a ( -- str$ ) " a" ;
: b ( -- str$ ) " b" ;

shield

\ --[ Demo ]----------------------------------------------------------

\ getname => a () |-> a b .
\ The "." should print this: "a=>(a|->b)"
\
\ IT DOES!!

\ --------------------------------------------------------------------





#####
#
# on uploading marc's RubyForth tarballs to twu
# 2008jan07
#
#####

# «rubyforth-angg»  (to ".rubyforth-angg")
# «rubyforth-uploading»  (to ".rubyforth-uploading")
# (find-angg "rubyforth/")
# (find-angg "rubyforth/README.too")
# http://angg.twu.net/rubyforth/
# http://angg.twu.net/rubyforth/README.too.html
# http://angg.twu.net/rubyforth/rubyforth-0.24.tar.gz
# http://angg.twu.net/rubyforth/blocks.tar.gz
# http://rubyforth.sourceforge.net/
# http://rubyforth.sourceforge.net/blocks.tar.gz
# http://rubyforth.sourceforge.net/rubyforth-0.24.tar.gz
#*
rm -Rfv ~/usrc/rubyforth/
tar -C  ~/usrc/ -xvzf \
  $S/http/rubyforth.sourceforge.net/rubyforth-0.24.tar.gz
cd      ~/usrc/rubyforth/

#*
cd      ~/usrc/rubyforth/
for i in $(find * -type f | sort); do cp -av $i ~/rubyforth/$i; done

#*
# To update my makefile:
# (find-sh "tar -tvzf \
    $S/http/rubyforth.sourceforge.net/rubyforth-0.24.tar.gz \
    | cut -b 59- | sort \
    | awk '{printf \"  rubyforth/%s\\n\", $0}'")
# (find-blogme3file "anggmake.lua")
# (find-blogme3file "anggmake.lua" "rubyforth/")

# (code-c-d "rubyforth"   "~/usrc/rubyforth/")
# (code-c-d "rubyforthsf" "$S/http/rubyforth.sourceforge.net/")
# (find-rubyforthfile "")
# (find-rubyforthsh "find * -type f | sort")

# To upload the binaries to angg/slow_html/:

* (eepitch-eshell)
* (eepitch-kill)
* (eepitch-eshell)

# (find-twusfile "rubyforth/")
# (find-twusfile "rubyforth/demos/")
# (find-angg "rubyforth/")
# (find-angg "rubyforth/demos/")

# (ee-cp (ee-rubyforthsffile "rubyforth-0.24.tar.gz") (ee-twusfile "rubyforth/rubyforth-0.24.tar.gz") 'over)
# (ee-cp (ee-rubyforthsffile "rubyforth-0.24.tar.gz") (ee-twupfile "rubyforth/rubyforth-0.24.tar.gz") 'over)

cd (ee-twusfile "rubyforth/")
cp -v $S/http/rubyforth.sourceforge.net/rubyforth-0.24.tar.gz .
cd (ee-twupfile "rubyforth/")
cp -v $S/http/rubyforth.sourceforge.net/rubyforth-0.24.tar.gz .

# Older scripts...
cd ~/rubyforth/
     # http://rubyforth.sourceforge.net/rubyforth-0.19.tar.gz
cp -v $S/http/rubyforth.sourceforge.net/rubyforth-0.19.tar.gz \
                       (ee-twusfile "rubyforth/")
     # http://rubyforth.sourceforge.net/blocks.tar.gz
cp -v $S/http/rubyforth.sourceforge.net/blocks.tar.gz \
                       (ee-twusfile "rubyforth/")
cd ~/rubyforth/demos/
cp -v cmforth.blk      (ee-twusfile "rubyforth/demos/")
cp -v f83kernel.blk    (ee-twusfile "rubyforth/demos/")







#####
#
# rubyforth demos
# 2008jan02
#
#####

# «rubyforth-demos»  (to ".rubyforth-demos")
# (find-angg ".emacs" "eepitch-rubyforth")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv /tmp/rubyforth/
mkdir  /tmp/rubyforth/
cd     /tmp/rubyforth/
wget http://angg.twu.net/rubyforth/rubyforth-0.19.tar.gz
tar -xvzf rubyforth-0.19.tar.gz
cd     /tmp/rubyforth/rubyforth-0.19/

# (find-angg ".emacs" "eepitch-rubyforth")
# (code-c-d "rubyforth" "/tmp/rubyforth/rubyforth-0.19/" :anchor)
# (find-rubyforthfile "")





#####
#
# Porting lstrip, strip and rstrip to Lua
# 2008nov08
#
#####

# «lrstrip»  (to ".lrstrip")
# (find-pragmaticrubytext "\nlstrip!")
# (find-pragmaticrubytext "\nstrip!")
# (find-pragmaticrubytext "\nrstrip!")

* (eepitch-ruby)
* (eepitch-kill)
* (eepitch-ruby)
" a b c ".lstrip!
" a b c ".strip!
" a b c ".rstrip!

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
lstrip = function (str) return str:match("^[ \t]*(.*)$") end
 strip = function (str) return str:match("^[ \t]*(.-)[ \t]*$") end
rstrip = function (str) return str:match(      "^(.-)[ \t]*$") end
PP(lstrip("  a b c  "))
PP( strip("  a b c  "))
PP(rstrip("  a b c  "))




#####
#
# luaforth (a port of rubyforth to Lua)
# 2008nov06
#
#####

# «luaforth»  (to ".luaforth")
-- (find-angg "rubyforth/stack.rb")
-- (find-angg "rubyforth/")
-- (find-angg "rubyforth/README.too")
-- (find-rubyforth "kernel.rb")
-- (find-rubyforthfile "kernel.rb" "def code")
-- (find-rubyforthfile "primitives.rb")
-- (find-anggfile "LUA/luaforth.lua" "header_with =")
-- (find-anggfile "LUA/luaforth.lua" "active_wordlist =")
-- (find-rubyforthfile "kernel.rb" "-[ Wordlists ]-")
-- (find-rubyforthfile "vocabulary.rb" "def current_vocab")
-- (find-rubyforthfile "kernel.rb" "push_vocab($rubyforth)")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
ee_dofile "~/LUA/luaforth.lua"  -- (find-angg "LUA/luaforth.lua")
-- (find-anggfile "LUA/luaforth.lua" "\ncode =")
code "22"
code "22 33 + ."
code ": foo 22 33 + . ;"


current_line = "22 33 + ."
= forth_process_line()
= current_line


compiler()                      -- COMPILER words.
= context
PP(compiler_words())
PP(current_vocab())
prim(";", "forth_exit()")

-- (find-anggfile "LUA/luaforth.lua" "active_wordlist =")
PP(active_wordlist())

* (eepitch-rubyforth)
* (eepitch-kill)
* (eepitch-rubyforth)
needs tools/repl.fs  enter-ruby
active_wordlist
current_vocab

* (eepitch-rubyforth)
* (eepitch-kill)
* (eepitch-rubyforth)
220 22 33 .r
. .



#####
#
# duoforth
# 2010mar01
#
#####

# «duoforth»  (to ".duoforth")
# (find-fline "~/tmp/duoforth/")
# (find-fline "~/tmp/duoforth/duo-af7246f.tar.gz")
# (find-fline "~/tmp/duoforth/duo-700c5ac.tgz")
#*
rm -Rv ~/usrc/duoforth++/
tar -C ~/usrc/ -xvzf \
  ~/tmp/duoforth/duo-700c5ac.tgz
cd     ~/usrc/duoforth++/

#*
# (code-c-d "duoforth" "~/usrc/duoforth++/")
# (find-duoforthfile "")

# (find-es "anatocc" "LD_PRELOAD")
echo  $LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LUA51SRC/lib
make CFLAGS=-I$LUA51SRC/include LDFLAGS="-L$LUA51SRC/lib -ldl -llua"

* (setenv "LD_LIBRARY_PATH" (ee-expand "$LUA51SRC/lib"))
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
# (find-fline "$LUA51SRC/lib/")
rm -Rv ~/usrc/duoforth++/
tar -C ~/usrc/ -xvzf \
  ~/tmp/duoforth/duo-700c5ac.tgz
cd     ~/usrc/duoforth++/
cp -iv ~/tmp/duoforth/test.fs \
       ~/usrc/duoforth++/
cd     ~/usrc/duoforth++/
cp -v $LUA51SRC/lib/liblua.so .
make CFLAGS=-I$LUA51SRC/include LDFLAGS="-L$LUA51SRC/lib -ldl -llua"

words

# (find-efunction 'ee-eepitch-comint)
(defun eepitch-duoforth () (interactive) (ee-eepitch-comint ee-duoforthdir "duoforth++" "duoforth++"))

* (eepitch-duoforth)
* (eepitch-kill)
* (eepitch-duoforth)

# (code-c-d "duoforth" "~/usrc/duoforth/")
# (find-duoforthfile "")
# (find-duoforthfile "Makefile")
# (find-duoforthfile "test.fs")
# (find-fline "$LUA51SRC")
# (find-esgrep "grep -nH -e ldl *.e")

## CFLAGS+=-I/usr/include/lua5.1 
# CFLAGS+=-I/usr/include/lua5.1 -DCOLOUR
# LDFLAGS+=-llua5.1




#####
#
# df-lua-0.0.3
# 2011jan12
#
#####

# «dflua»  (to ".dflua")
# (find-angg ".emacs" "dflua")
# (find-fline       "~/tmp/" "df-lua")
# (find-template-untgz "~/tmp/df-lua-0.0.3.tgz" "dflua")
#*
rm -Rv ~/usrc/df-lua-0.0.3/
tar -C ~/usrc/ -xvzf \
  /home/edrx/tmp/df-lua-0.0.3.tgz
cd     ~/usrc/df-lua-0.0.3/

#*
# (code-c-d "dflua" "~/usrc/df-lua-0.0.3/")
# (find-dfluagrep "grep -nRH -e see *")
# (find-dfluafile "")
# (find-dfluafile "demo/")
# (find-dfluafile "demo/lua-eval.fs")
# (find-dfluafile "demo/power.fs")
# (find-dfluafile "forth.lua")
# (find-dfluafile "forth/")
# (find-dfluafile "forth/core.lua" "here!")
# (find-dfluafile "forth/core.lua" "forth.prim.see")
# (find-dfluafile "forth/core.lua" "forth.prim.lua_eval")
# (find-dfluafile "forth/diagram.lua")
# (find-dfluafile "forth/diagram.lua" "local fmt")
# (find-dfluafile "forth/inner.lua")
#  (find-angg ".emacs.papers" "ochs")
# (find-dfluafile "forth/memory.lua")
# (find-dfluafile "forth/outer.lua")
# (find-dfluafile "forth/primitives.lua")
# (find-dfluafile "forth/wordlists.lua")
#  http://angg.twu.net/rubyforth/kernel.rb.html
# (find-angg "rubyforth/kernel.rb")


;; http://angg.twu.net/miniforth/miniforth-article.pdf

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd     ~/usrc/df-lua-0.0.3/
./forth.lua demo/power.fs
2 .cube
.heap
see .cube

* (eepitch-dflua)
* (eepitch-kill)
* (eepitch-dflua)
words
include demo/power.fs
words
2 .cube
.heap
see .cube

* (eepitch-dflua)
* (eepitch-kill)
* (eepitch-dflua)
2 3 * .
.
: 5* 5 * ;
2 5* .
see 5*
' 5* .

macro : mrot ` push ` swap ` pop ` swap ; forth
: baz 1 2 3 mrot ;
see baz

: .greet1
." Hello world"
;
.greet1
see .greet1

forth
macro  
: .greet2
." Hello world"
;
.greet2





#####
#
# zbforth-0.0.1d
# 2011feb07
#
#####

# «zbforth»  (to ".zbforth")
# (find-angg ".emacs" "zbforth")
# (find-fline       "~/tmp/" "zbforth")
# (find-template-untgz "~/tmp/zbforth-0.0.1d.tgz" "zbforth")
#*
rm -Rv ~/usrc/zbforth-0.0.1d/
tar -C ~/usrc/ -xvzf \
  ~/tmp/zbforth-0.0.1d.tgz
cd     ~/usrc/zbforth-0.0.1d/

#*
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/zbforth-0.0.1d/
make -f Makefile.linux  |& tee om

# (find-zbforthfile "")

* (eepitch-zbforth)
* (eepitch-kill)
* (eepitch-zbforth)
words
.info
.macro
.forth
2 3 .s * .s . .s




# (find-angg "LUA/canvas2.lua" "Class" "transpose")











# RubyForth and MiniForth can be an answer to this:
# http://groups.google.com/group/comp.lang.forth/msg/446988d72234f64d







#  Local Variables:
#  coding:               raw-text-unix
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  End: