Skip to content

Instantly share code, notes, and snippets.

@syranez
Created October 9, 2011 18:06
Show Gist options
  • Save syranez/1273963 to your computer and use it in GitHub Desktop.
Save syranez/1273963 to your computer and use it in GitHub Desktop.
bashbf: working mnemonic "inc"
[2005][master][syranez@marathon:~/bashbf]$ ./examples/inc.sh
+ . ./modules/pc.sh
++ BASHBF_PC=0
+ . ./modules/parser.sh
+ . ./modules/band.sh
++ declare -a BASHBF_BAND
++ BASHBF_BAND_INDEX=0
+ . ./modules/program.sh
++ BASHBF_PROGRAM=
+ '[' -z + ']'
+ setProgram +
+ '[' -z + ']'
+ BASHBF_PROGRAM=+
+ execute
+ resetProgramCounter
+ setProgramCounter 0
+ '[' -z 0 ']'
+ BASHBF_PC=0
+ local token=
++ getProgramCounter
++ echo 0
+ local pc=0
++ getProgramLength
++ echo 1
+ local length=1
+ (( 0 < 1 ))
++ getToken
+++ getProgramCounter
+++ echo 0
++ local pc=0
+++ getProgram
+++ echo +
++ local program=+
++ echo +
+ token=+
+ parse +
+ '[' -z + ']'
+ local instruction=+
+ case $instruction in
+ parseInc
+ incValue
+ BASHBF_BAND["$BASHBF_BAND_INDEX"]=1
+ incProgramCounter
+ BASHBF_PC=1
++ getProgramCounter
++ echo 1
+ pc=1
+ (( 1 < 1 ))
+ exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment