Giter Site home page Giter Site logo

bashforth's Introduction

Bashforth

This Forth interpreter, entirely written as bash script, is a FÂł (Fully Functional Forth), albeit a tad slow. Some would call it "sluggish". As rough indication, an ARM SBC which I'm running Bashforth on takes about 15 second for an empty loop of 100,000 iterations. It has built-in doc and see facilities, simplifying exploration of Bashforth. Bashforth lacks floating point support and vocabularies, but comes with essentials like defining word builder, exception handling. It also provides an extra string stack, along with a set of words, operating on string stack.

Those interested in bashforth might like yoda which does away with the virtual machine and compiles directly to bash functions. As consequence can a substantial performance difference be realised (yoda is faster by a factor of somewhere between 30 and 50 times).
At this point yoda has progressed enough that I can say that now yoda is the better bashforth, being more potent while it's still smaller than bashforth. And it supports automatically including libraries.

bashforth's People

Contributors

bushmills avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bashforth's Issues

save-system / load-system

I am new to github so I do not know another way to contact you.

I like this shell script for test driving forth, without installing an compiled program.

Thanks for this software.

Here is a code that in my copy of the 0.59a bashforth version function well for save-system and load-system:

save_array_print() {
local i
local inext
local -n a=$1
   inext=0
   printf "a0\n"
   for i in "${!a[@]}"; do
   if [ "$inext" != "$i" ]; then
   printf 'ao %s\n' "$i"
   fi
   printf 'a %s\n' "${a[i]}"
   let "inext=++i"
   done
}

# -----------------------------------------------------------------------------
# ------------------------------- save-system ---------------------------------
# -----------------------------------------------------------------------------


# ( a c -- )
code saveas saveas
saveas()  {
local i
local inext
local len
   pack

   (
   printf "version %s\n" "$version"
   printf "wc %s\n" "$wc"
   printf "dp %s\n" "$dp"
   
save_array_print m
save_array_print h
save_array_print hf 
save_array_print x 
  
   ) > $tos
   tos=${s[sp--]}
}


# (  -- ) write image of system to file, file name taken from input stream
revealheader "save-system"
colon savesystem    $bl $stream $saveas


# -----------------------------------------------------------------------------
# ------------------------------- load-system ---------------------------------
# -----------------------------------------------------------------------------


# ( a c -- )
code loadfrom loadfrom
function loadfrom  {
   local load_version
   local cmd
   local prg
   local a
   local ai
   local linenr
   pack
   m=()
   h=()
   hf=()
   x=()   
   ai=0
   a=0
   fname=$tos
   tos=${s[sp--]}
   linenr=0
   while read -r line
   do
     prg=($line)
	 cmd=${prg[0]}
	 p1=${prg[1]}
	 p2=${prg[2]}
	 
   case $cmd in
   version)
		load_version=$p1
		if [ "$load_version" != "$version" ]; then
			echo "Not same Version : $load_version"
		fi
		;;
   wc) 
		wc=$p1
		;;
   dp)
		dp=$p1
		;;
   a0)
		ai=0
		let "a=++a"
		;;		
   ao)
		ai=$p1
		;;
   a) 
   case $a in
   1)
		m[ai++]=$p1
		;;
   2)
		h[ai++]=$p1
		;;
   3)
		hf[ai++]=$p1
		;;
	4)
		x[ai++]=$p1
		;;
	esac
		;;
	hlt) 
	ai=0
	break;
			;;
   esac
   let "linenr=++linenr"
   done < $fname
}

Tag releases

Based on the changelog at the top of the "bashforth" file, there have been many releases of bashforth over the past 19 years, yet there are no git tags in this repository. Could you please tag your releases?

LICENSE file needs editing

The LICENSE file is obviously copy and pasted from the GNU/FSF website and was never edited to reflect the program or author. There are template fields like {description}, {year} and {fullname} that are left un-modified. It also includes boilerplate "notice" statements regarding the fictional program named "Gnomovision". I highly suggest the author spend a few minutes to read through the LICENSE file and edit it appropriately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.