yabfi 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 554b1d443d15e2f2b4668bf8bcc779323f9336d0
4
+ data.tar.gz: b5a416154d4f62938536db6129aee81729d90d94
5
+ SHA512:
6
+ metadata.gz: b0f9709ea4c6972d404aa93e9eab485e6aedfbb3386089c47ec89779f9158a8917af323b3c1dc9f62108fb3e3bf33c9f63b4865a1b82be0b120963210dcaae54
7
+ data.tar.gz: a318644c09f22cd341ec8950eb452d449fb08f7548cdaa4949af8b55b1501a32b7af4ec77248607070bf53a20eb78b5cf50c6ded99d4a83db4238c3b388ecfb3
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ lib/yabfi/vm.bundle
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --order random
4
+ --profile
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Tom Hulihan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # YABFI [![Build Status](https://travis-ci.org/nahiluhmot/yabfi.svg)](https://travis-ci.org/nahiluhmot/yabfi) [![Gem Version](https://badge.fury.io/rb/yabfi.svg)](http://badge.fury.io/rb/yabfi)
2
+
3
+ Yet another YABFI interpreter written in Ruby.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'yabfi'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+
21
+ ```bash
22
+ $ gem install yabfi
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ This gem can either be used via native Ruby calls or from the command line.
28
+ To use the gem from ruby, a top level method, `.eval!` is provided. By default,
29
+ than method will use `$stdin` as input, `$stdout` as output, and `0` as the
30
+ value to return when `EOF` is reached.
31
+
32
+ Below is an execution of a clone of the standard Unix `cat` utility.
33
+
34
+ ```ruby
35
+ > cat = ',[.,]'
36
+ > YABFI.eval!(cat)
37
+ sample input
38
+ ^D
39
+ sample input
40
+ # => nil
41
+ ```
42
+
43
+ The program's `input`, `output`, and `eof` may all be set via keyword arguments to this method.
44
+
45
+ The gem also exports an executable called `yabfi`.
46
+ Here is some example usage of the same cat program from above:
47
+
48
+ ```shell
49
+ $ yabfi -x',[,.]'
50
+ hello, world
51
+ ^D
52
+ hello, world
53
+ $
54
+ ```
55
+
56
+ Execute `yabfi -h` for a full list of options.
57
+
58
+ ## Development
59
+
60
+ After checking out the repo, run `bundle install` to install dependencies.
61
+ Then, run `bundle exec rake shell` for an interactive prompt that will allow you to experiment.
62
+
63
+ To install this gem onto your local machine, run `bundle exec rake install`.
64
+ To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
65
+
66
+ ## Contributing
67
+
68
+ 1. Fork it ( https://github.com/nahiluhmot/yabfi/fork )
69
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
70
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
71
+ 4. Push to the branch (`git push origin my-new-feature`)
72
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/extensiontask'
3
+ require 'rspec/core/rake_task'
4
+ require 'rubocop/rake_task'
5
+ require 'pry'
6
+ require 'yard'
7
+
8
+ # Reference to the gemspec used by rake-compiler and the package taks.
9
+ GEMSPEC = Gem::Specification.find_by_name('yabfi')
10
+
11
+ desc 'Compile the C virtual machine'
12
+ Rake::ExtensionTask.new do |task|
13
+ task.name = 'vm'
14
+ task.ext_dir = 'ext/yabfi'
15
+ task.lib_dir = 'lib/yabfi'
16
+ task.gem_spec = GEMSPEC
17
+ end
18
+
19
+ desc 'Make package tasks for the gem'
20
+ Gem::PackageTask.new(GEMSPEC)
21
+
22
+ desc 'Run the specs'
23
+ RSpec::Core::RakeTask.new(spec: :compile)
24
+
25
+ desc 'Run the code quality metrics'
26
+ RuboCop::RakeTask.new(:quality)
27
+
28
+ desc 'Generate gem documentation'
29
+ YARD::Rake::YardocTask.new(:doc)
30
+
31
+ desc 'Load the gem source code'
32
+ task environment: :compile do
33
+ lib = File.expand_path('lib', File.dirname(__FILE__))
34
+ $LOAD_PATH << lib unless $LOAD_PATH.include?(lib)
35
+ require 'yabfi'
36
+ end
37
+
38
+ desc 'Start a pry shell in the context of the YABFI module'
39
+ task shell: :environment do
40
+ Pry.start(YABFI)
41
+ end
42
+
43
+ desc 'Clean the files generated by other tasks'
44
+ task :clean do
45
+ %w(coverage doc pkg tmp).each do |partial|
46
+ path = File.expand_path(partial, File.dirname(__FILE__))
47
+ next unless File.exist?(path)
48
+ FileUtils.rm_rf(path)
49
+ end
50
+ end
51
+
52
+ desc 'Run the specs, quality metrics, and documentation tasks'
53
+ task default: [:clean, :spec, :quality, :doc]
data/bin/yabfi ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yabfi'
4
+ require 'optparse'
5
+
6
+ options = {
7
+ input: $stdin,
8
+ output: $stdout,
9
+ eof: 0
10
+ }
11
+ commands = nil
12
+
13
+ parser = OptionParser.new do |opts|
14
+ opts.banner = 'Usage: yabfi [options]'
15
+
16
+ opts.version = YABFI::VERSION
17
+ opts.separator ''
18
+ opts.separator 'Specific Options:'
19
+
20
+ opts.on('-x', '--execute COMMANDS', 'Commands to execute from ARGV') do |cs|
21
+ commands = cs
22
+ end
23
+
24
+ opts.on('-c', '--commands FILE', 'The file to read commands from') do |cs|
25
+ commands = File.open(cs, 'r')
26
+ end
27
+
28
+ opts.on('-i', '--input FILE', 'The file from which to read input') do |input|
29
+ options[:input] = File.open(input, 'r')
30
+ end
31
+
32
+ opts.on('-o', '--output FILE', 'The file to which to write output') do |out|
33
+ options[:output] = File.open(out, 'w')
34
+ end
35
+
36
+ opts.on('-e', '--eof N', Integer, 'The Integer to return at EOF') do |eof|
37
+ options[:eof] = eof
38
+ end
39
+ end
40
+
41
+ parser.parse!(ARGV)
42
+
43
+ begin
44
+ exit_val = -1
45
+ fail 'No commands given' if commands.nil?
46
+ YABFI.eval!(commands, **options)
47
+ exit_val = 0
48
+ rescue YABFI::BaseError => ex
49
+ puts "Error in source file: #{ex.class.name}: #{ex.message}"
50
+ exit_val = 1
51
+ rescue => ex
52
+ puts "Error in interpreter: #{ex.class.name}: #{ex.message}"
53
+ exit_val = 2
54
+ ensure
55
+ exit(exit_val)
56
+ end
@@ -0,0 +1,31 @@
1
+ +++[>+++++<-]>>+<[>>++++>++>+++++>+++++>+>>+<++[++<]>---]
2
+
3
+ >++++.>>>.+++++.>------.<--.+++++++++.>+.+.<<<<---.[>]<<.<<<.-------.>++++.
4
+ <+++++.+.>-----.>+.<++++.>>++.>-----.
5
+
6
+ <<<-----.+++++.-------.<--.<<<.>>>.<<+.>------.-..--.+++.-----<++.<--[>+<-]
7
+ >>>>>--.--.<++++.>>-.<<<.>>>--.>.
8
+
9
+ <<<<-----.>----.++++++++.----<+.+++++++++>>--.+.++<<<<.[>]<.>>
10
+
11
+ ,[>>+++[<+++++++>-]<[<[-[-<]]>>[>]<-]<[<+++++>-[<+++>-[<-->-[<+++>-
12
+ [<++++[>[->>]<[>>]<<-]>[<+++>-[<--->-[<++++>-[<+++[>[-[-[-[->>]]]]<[>>]<<-]
13
+ >[<+>-[<->-[<++>-[<[-]>-]]]]]]]]]]]]]
14
+
15
+ <[
16
+ -[-[>+<-]>]
17
+ <[<<<<.>+++.+.+++.-------.>---.++.<.>-.++<<<<.[>]>>>>>>>>>]
18
+ <[[<]>++.--[>]>>>>>>>>]
19
+ <[<<++..-->>>>>>]
20
+ <[<<..>>>>>]
21
+ <[<<..-.+>>>>]
22
+ <[<<++..---.+>>>]
23
+ <[<<<.>>.>>>>>]
24
+ <[<<<<-----.+++++>.----.+++.+>---.<<<-.[>]>]
25
+ <[<<<<.-----.>++++.<++.+++>----.>---.<<<.-[>]]
26
+ <[<<<<<----.>>.<<.+++++.>>>+.++>.>>]
27
+ <.>
28
+ ]>
29
+ ,]
30
+
31
+ <<<<<.<+.>++++.<----.>>---.<<<-.>>>+.>.>.[<]>++.[>]<.
data/example/cat.b ADDED
@@ -0,0 +1 @@
1
+ ,[.,]
@@ -0,0 +1,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>>>+<<<<<<<<<]>>>>>>>>>]>>>>>
138
+ +>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>[-<<<<<<->>>>>>]+<
139
+ <<<<<[->>>>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<
140
+ <<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>
141
+ -<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>>
142
+ >>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
143
+ +[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
144
+ <<<<<]]>>>]
@@ -0,0 +1,7 @@
1
+ require 'mkmf'
2
+
3
+ %w(calloc malloc memset free).each do |func|
4
+ abort "missing #{func}()" unless have_func(func)
5
+ end
6
+
7
+ create_makefile 'yabfi/vm'