####### # # 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 # or at . # See also , # , # , # , # and . # ####### # «.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") ##### # # on uploading marc's RubyForth tarballs to twu # 2008jan07 # ##### # «rubyforth» (to ".rubyforth") # «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 "")  (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 *")  (eepitch-shell)  (eepitch-kill)  (eepitch-shell) cd /tmp/rubyforth/rubyforth-0.19/ ./install.sh /tmp/rubyforth/ cd /tmp/rubyforth/ ./rubyforth 1 2 + . include tools/system.fs # (find-angg "rubyforth/README.too") \ ==================================================================== \ Implementation of Eduardo's 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!! \ -------------------------------------------------------------------- ##### # # 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 # 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: