Skip to content

Commit

Permalink
Merge pull request #70 from DJMcMayhem/master
Browse files Browse the repository at this point in the history
Release 1.3.1
  • Loading branch information
Wheatwizard authored Apr 14, 2017
2 parents 40cbde4 + 54283eb commit d17c9e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Interpreter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def do_debug_flag(index)
when "av" then STDERR.puts (@current_value%256).chr(Encoding::UTF_8)
when "uv" then STDERR.puts (@current_value%2**32).chr(Encoding::UTF_8)
when "dc","ac" then
print @active_stack == @left ? "(left) " : "(right) "
STDERR.print @active_stack == @left ? "(left) " : "(right) "
case flag.to_s
when "dc" then
STDERR.puts @active_stack.inspect_array
Expand Down Expand Up @@ -146,7 +146,7 @@ def do_debug_flag(index)
@current_value = sub_interpreter.current_value
when "dh" then STDERR.puts @active_stack.height
when "lt" then
print "\n"
STDERR.print "\n"
@current_value += flag.get_data
when "pu" then
#Take input
Expand Down Expand Up @@ -247,11 +247,11 @@ def inspect
index = @index
offset = 0
@debug_flags.each_pair do |k,v|
v.each do |sym|
source.insert(k + offset, "#%s" % sym.id2name);
offset += sym.id2name.length + 1
v.each do |flag|
source.insert(k + offset, "@%s" % flag.to_s);
offset += flag.to_s.length + 1
if k <= index then
index += sym.id2name.length + 1
index += flag.to_s.length + 1
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Brain-Flak is an "Turing-tarpit", e.g. a language which can, *in theory* compute

To get started with Brain-Flak, download the project from here, and run `ruby brain_flak.rb inputs`. Additionally, you can [try it online](http://brain-flak.tryitonline.net/)! (Online intrepreter provided thanks to [@DennisMitchell](https://github.com/DennisMitchell))

#Tutorial
# Tutorial

Brain-Flak has two stacks, known as 'left' and 'right'. The active stack starts at left. If an empty stack is popped, it will return 0. That's it. No other variables. When the program starts, each command line argument is pushed on to the active stack.

Expand Down Expand Up @@ -48,7 +48,7 @@ When the program is done executing, each value left on the active stack is print

That's it. That's the whole language.

#Sample code
# Sample code

Here are some full programs that do interesting things.

Expand Down
5 changes: 3 additions & 2 deletions brain_flak.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative './stack.rb'
require_relative './Interpreter.rb'

VERSION_STRING = "Brain-Flak Ruby Interpreter v1.3.0"
VERSION_STRING = "Brain-Flak Ruby Interpreter v1.3.1"

require 'optparse'

Expand Down Expand Up @@ -30,11 +30,13 @@
["ar","Prints the right stack as ASCII characters"],
["cy","Prints the number of elapsed cycles"],
["dc","Prints the current stack in decimal"],
["dh","Prints the height of the current stack in decimal"],
["dl","Prints the left stack in decimal"],
["dv","Prints the current value of the scope in decimal"],
["dr","Prints the right stack in decimal"],
["ex","Terminates the program"],
["ij","Pauses program and prompts user for Brain-Flak code to be run in place of the flag"],
["lt","Passed with a number after the @lt (e.g. @lt6). Evaluates to the number passed with it"],
["pu","Pauses the program until the user hits the return key"],
]
flag_desc.each do | flag |
Expand All @@ -43,7 +45,6 @@
end

opts.on("-f", "--file=FILE", "Reads input for the brain-flak program from FILE, rather than from the command line.") do |file|
puts file
arg_path = file
end

Expand Down

0 comments on commit d17c9e1

Please sign in to comment.