whitespace-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/LICENSE.md +21 -0
- data/README.md +52 -0
- data/Rakefile +10 -0
- data/bin/whitespace +67 -0
- data/examples/count.ws +76 -0
- data/examples/fact.ws +135 -0
- data/examples/hello.ws +110 -0
- data/examples/name.ws +135 -0
- data/lib/whitespace.rb +14 -0
- data/lib/whitespace/data_structures/console.rb +56 -0
- data/lib/whitespace/data_structures/counter.rb +24 -0
- data/lib/whitespace/data_structures/memory.rb +19 -0
- data/lib/whitespace/data_structures/stack.rb +25 -0
- data/lib/whitespace/instructions/arithmetic/add.rb +9 -0
- data/lib/whitespace/instructions/arithmetic/binop.rb +18 -0
- data/lib/whitespace/instructions/arithmetic/div.rb +9 -0
- data/lib/whitespace/instructions/arithmetic/mod.rb +9 -0
- data/lib/whitespace/instructions/arithmetic/mul.rb +9 -0
- data/lib/whitespace/instructions/arithmetic/sub.rb +9 -0
- data/lib/whitespace/instructions/flow_control/call.rb +19 -0
- data/lib/whitespace/instructions/flow_control/end.rb +7 -0
- data/lib/whitespace/instructions/flow_control/label.rb +16 -0
- data/lib/whitespace/instructions/flow_control/njmp.rb +20 -0
- data/lib/whitespace/instructions/flow_control/return.rb +7 -0
- data/lib/whitespace/instructions/flow_control/ujmp.rb +18 -0
- data/lib/whitespace/instructions/flow_control/zjmp.rb +20 -0
- data/lib/whitespace/instructions/heap_access/retrieve.rb +9 -0
- data/lib/whitespace/instructions/heap_access/store.rb +10 -0
- data/lib/whitespace/instructions/instruction.rb +13 -0
- data/lib/whitespace/instructions/io/putc.rb +15 -0
- data/lib/whitespace/instructions/io/putn.rb +15 -0
- data/lib/whitespace/instructions/io/readc.rb +16 -0
- data/lib/whitespace/instructions/io/readn.rb +16 -0
- data/lib/whitespace/instructions/stack_manipulation/discard.rb +7 -0
- data/lib/whitespace/instructions/stack_manipulation/dup.rb +7 -0
- data/lib/whitespace/instructions/stack_manipulation/push.rb +17 -0
- data/lib/whitespace/instructions/stack_manipulation/swap.rb +11 -0
- data/lib/whitespace/isa.rb +9 -0
- data/lib/whitespace/parser.rb +243 -0
- data/lib/whitespace/util.rb +37 -0
- data/lib/whitespace/version.rb +3 -0
- data/lib/whitespace/vm.rb +44 -0
- data/test/test_helper.rb +4 -0
- data/test/whitespace/data_structures/console_test.rb +113 -0
- data/test/whitespace/data_structures/counter_test.rb +37 -0
- data/test/whitespace/data_structures/memory_test.rb +25 -0
- data/test/whitespace/data_structures/stack_test.rb +63 -0
- data/test/whitespace/instructions/arithmetic/add_test.rb +43 -0
- data/test/whitespace/instructions/arithmetic/div_test.rb +52 -0
- data/test/whitespace/instructions/arithmetic/mod_test.rb +52 -0
- data/test/whitespace/instructions/arithmetic/mul_test.rb +43 -0
- data/test/whitespace/instructions/arithmetic/sub_test.rb +43 -0
- data/test/whitespace/instructions/flow_control/call_test.rb +50 -0
- data/test/whitespace/instructions/flow_control/end_test.rb +15 -0
- data/test/whitespace/instructions/flow_control/label_test.rb +24 -0
- data/test/whitespace/instructions/flow_control/njmp_test.rb +94 -0
- data/test/whitespace/instructions/flow_control/return_test.rb +33 -0
- data/test/whitespace/instructions/flow_control/ujmp_test.rb +44 -0
- data/test/whitespace/instructions/flow_control/zjmp_test.rb +94 -0
- data/test/whitespace/instructions/heap_access/retrieve_test.rb +49 -0
- data/test/whitespace/instructions/heap_access/store_test.rb +44 -0
- data/test/whitespace/instructions/instruction_test.rb +11 -0
- data/test/whitespace/instructions/io/putc_test.rb +42 -0
- data/test/whitespace/instructions/io/putn_test.rb +42 -0
- data/test/whitespace/instructions/io/readc_test.rb +71 -0
- data/test/whitespace/instructions/io/readn_test.rb +79 -0
- data/test/whitespace/instructions/stack_manipulation/discard_test.rb +30 -0
- data/test/whitespace/instructions/stack_manipulation/dup_test.rb +32 -0
- data/test/whitespace/instructions/stack_manipulation/push_test.rb +30 -0
- data/test/whitespace/instructions/stack_manipulation/swap_test.rb +43 -0
- data/test/whitespace/parser_test.rb +362 -0
- data/test/whitespace/util_test.rb +87 -0
- data/test/whitespace/vm_test.rb +80 -0
- data/whitespace-ruby.gemspec +30 -0
- metadata +178 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative "lib/whitespace/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.author = "Dwayne Crooks"
|
5
|
+
s.email = "me@dwaynecrooks.com"
|
6
|
+
|
7
|
+
s.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
|
8
|
+
An interpreter written in Ruby for the imperative,
|
9
|
+
stack based language called Whitespace.
|
10
|
+
DESCRIPTION
|
11
|
+
|
12
|
+
s.summary = "A Whitespace interpreter written in Ruby"
|
13
|
+
s.homepage = "https://github.com/dwayne/whitespace-ruby"
|
14
|
+
s.license = "MIT"
|
15
|
+
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
|
20
|
+
s.name = "whitespace-ruby"
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
s.version = Whitespace::VERSION
|
23
|
+
|
24
|
+
s.required_ruby_version = ">= 2.3"
|
25
|
+
|
26
|
+
s.add_development_dependency "bundler", "~> 1.12"
|
27
|
+
s.add_development_dependency "minitest", "~> 5.9"
|
28
|
+
s.add_development_dependency "pry-byebug", "~> 3.4"
|
29
|
+
s.add_development_dependency "rake", "~> 11.2"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whitespace-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dwayne Crooks
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '11.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '11.2'
|
69
|
+
description: An interpreter written in Ruby for the imperative, stack based language
|
70
|
+
called Whitespace.
|
71
|
+
email: me@dwaynecrooks.com
|
72
|
+
executables:
|
73
|
+
- whitespace
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.md
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/whitespace
|
83
|
+
- examples/count.ws
|
84
|
+
- examples/fact.ws
|
85
|
+
- examples/hello.ws
|
86
|
+
- examples/name.ws
|
87
|
+
- lib/whitespace.rb
|
88
|
+
- lib/whitespace/data_structures/console.rb
|
89
|
+
- lib/whitespace/data_structures/counter.rb
|
90
|
+
- lib/whitespace/data_structures/memory.rb
|
91
|
+
- lib/whitespace/data_structures/stack.rb
|
92
|
+
- lib/whitespace/instructions/arithmetic/add.rb
|
93
|
+
- lib/whitespace/instructions/arithmetic/binop.rb
|
94
|
+
- lib/whitespace/instructions/arithmetic/div.rb
|
95
|
+
- lib/whitespace/instructions/arithmetic/mod.rb
|
96
|
+
- lib/whitespace/instructions/arithmetic/mul.rb
|
97
|
+
- lib/whitespace/instructions/arithmetic/sub.rb
|
98
|
+
- lib/whitespace/instructions/flow_control/call.rb
|
99
|
+
- lib/whitespace/instructions/flow_control/end.rb
|
100
|
+
- lib/whitespace/instructions/flow_control/label.rb
|
101
|
+
- lib/whitespace/instructions/flow_control/njmp.rb
|
102
|
+
- lib/whitespace/instructions/flow_control/return.rb
|
103
|
+
- lib/whitespace/instructions/flow_control/ujmp.rb
|
104
|
+
- lib/whitespace/instructions/flow_control/zjmp.rb
|
105
|
+
- lib/whitespace/instructions/heap_access/retrieve.rb
|
106
|
+
- lib/whitespace/instructions/heap_access/store.rb
|
107
|
+
- lib/whitespace/instructions/instruction.rb
|
108
|
+
- lib/whitespace/instructions/io/putc.rb
|
109
|
+
- lib/whitespace/instructions/io/putn.rb
|
110
|
+
- lib/whitespace/instructions/io/readc.rb
|
111
|
+
- lib/whitespace/instructions/io/readn.rb
|
112
|
+
- lib/whitespace/instructions/stack_manipulation/discard.rb
|
113
|
+
- lib/whitespace/instructions/stack_manipulation/dup.rb
|
114
|
+
- lib/whitespace/instructions/stack_manipulation/push.rb
|
115
|
+
- lib/whitespace/instructions/stack_manipulation/swap.rb
|
116
|
+
- lib/whitespace/isa.rb
|
117
|
+
- lib/whitespace/parser.rb
|
118
|
+
- lib/whitespace/util.rb
|
119
|
+
- lib/whitespace/version.rb
|
120
|
+
- lib/whitespace/vm.rb
|
121
|
+
- test/test_helper.rb
|
122
|
+
- test/whitespace/data_structures/console_test.rb
|
123
|
+
- test/whitespace/data_structures/counter_test.rb
|
124
|
+
- test/whitespace/data_structures/memory_test.rb
|
125
|
+
- test/whitespace/data_structures/stack_test.rb
|
126
|
+
- test/whitespace/instructions/arithmetic/add_test.rb
|
127
|
+
- test/whitespace/instructions/arithmetic/div_test.rb
|
128
|
+
- test/whitespace/instructions/arithmetic/mod_test.rb
|
129
|
+
- test/whitespace/instructions/arithmetic/mul_test.rb
|
130
|
+
- test/whitespace/instructions/arithmetic/sub_test.rb
|
131
|
+
- test/whitespace/instructions/flow_control/call_test.rb
|
132
|
+
- test/whitespace/instructions/flow_control/end_test.rb
|
133
|
+
- test/whitespace/instructions/flow_control/label_test.rb
|
134
|
+
- test/whitespace/instructions/flow_control/njmp_test.rb
|
135
|
+
- test/whitespace/instructions/flow_control/return_test.rb
|
136
|
+
- test/whitespace/instructions/flow_control/ujmp_test.rb
|
137
|
+
- test/whitespace/instructions/flow_control/zjmp_test.rb
|
138
|
+
- test/whitespace/instructions/heap_access/retrieve_test.rb
|
139
|
+
- test/whitespace/instructions/heap_access/store_test.rb
|
140
|
+
- test/whitespace/instructions/instruction_test.rb
|
141
|
+
- test/whitespace/instructions/io/putc_test.rb
|
142
|
+
- test/whitespace/instructions/io/putn_test.rb
|
143
|
+
- test/whitespace/instructions/io/readc_test.rb
|
144
|
+
- test/whitespace/instructions/io/readn_test.rb
|
145
|
+
- test/whitespace/instructions/stack_manipulation/discard_test.rb
|
146
|
+
- test/whitespace/instructions/stack_manipulation/dup_test.rb
|
147
|
+
- test/whitespace/instructions/stack_manipulation/push_test.rb
|
148
|
+
- test/whitespace/instructions/stack_manipulation/swap_test.rb
|
149
|
+
- test/whitespace/parser_test.rb
|
150
|
+
- test/whitespace/util_test.rb
|
151
|
+
- test/whitespace/vm_test.rb
|
152
|
+
- whitespace-ruby.gemspec
|
153
|
+
homepage: https://github.com/dwayne/whitespace-ruby
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
metadata: {}
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '2.3'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.6.4
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: A Whitespace interpreter written in Ruby
|
177
|
+
test_files: []
|
178
|
+
has_rdoc:
|