esolang 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9d345d961806358f901ff9820179070cd9c2888ba293e1d300158d6e72929bf
4
- data.tar.gz: 45547c31e8f9a30aa72a7647a0d2f331f99c6931ca44540c88cc2ecd3471e61b
3
+ metadata.gz: 988e5c8831b682d93c8f1327f40657de3a33ff43d27a760536d5760d4a39b1b7
4
+ data.tar.gz: 9d73d7a042afe6482ac848b60ed9da2f4cc8a2127209cd38940dfb6f662b3d64
5
5
  SHA512:
6
- metadata.gz: 5a44f2d94aa4d003da02ab71cce342cba9461e5db00ebeeff9ed5aed7aa6b3c53dfc1cc2e6b26b8ad1ebb4f9b8236b32d40d35a54291218a0eb579c0696ea864
7
- data.tar.gz: 2dfb391b39464a08ecbe8003cbacda152eab58095e77324b49acfdbcc9a075fa3d277020d8015b40330dc6fc05a1694df11a5d7688461ef811d9f147811f2cea
6
+ metadata.gz: 7bc77fde9c0d5571d40cb7d0d89ef767491deed0890eb4a3ddeabe9b8b1ecf8b8c5b2f61fe0313585851d3f4947673b4c830f9f6624c28a1c93d64fcc23c9ed6
7
+ data.tar.gz: ed4ed34a1e9d6337cf787ad1c5c09995463e2b3b016d0b43b26efe956a8367f9406c94375f806223a1a7db4ed0888585749d04c9c039009ff9febe36af879244
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # esolang
2
+
3
+ A Ruby gem for interpreting esoteric programming languages.
4
+
5
+ Supported at the moment: Smallfuck, Boolfuck, Paintfuck, Brainfuck, Ook! (with method to feet the memory pointer with bananas)
6
+
7
+ This gem is inspired by [this](https://www.codewars.com/kata/esolang-interpreters-number-1-introduction-to-esolangs-and-my-first-interpreter-ministringfuck) Kata Series on Codewars that ignited my passion for esolangs. Special thanks to the author [donaldsebleung](https://www.codewars.com/users/donaldsebleung).
8
+
9
+ Codesnippets for tests and examples are copies or variations from [Esolangs wiki](https://esolangs.org/) or [Wikipedia](https://www.wikipedia.org/)
10
+
11
+ This is an ongoing fun and educational project, and the author assumes no liability for the accuracy and completeness of the implementations.
12
+
13
+ ## Installation
14
+
15
+ To use the `esolang` gem, you can install it via:
16
+
17
+ ```bash
18
+ gem install esolang
19
+ ```
20
+
21
+ ## Example Usage
22
+ ```ruby
23
+ require 'esolang'
24
+ using Esolang::Refinements
25
+
26
+ code = ";;;+;+;;+;+;
27
+ +;+;+;+;;+;;+;
28
+ ;;+;;+;+;;+;
29
+ ;;+;;+;+;;+;
30
+ +;;;;+;+;;+;
31
+ ;;+;;+;+;+;;
32
+ ;;;;;+;+;;
33
+ +;;;+;+;;;+;
34
+ +;;;;+;+;;+;
35
+ ;+;+;;+;;;+;
36
+ ;;+;;+;+;;+;
37
+ ;;+;+;;+;;+;
38
+ +;+;;;;+;+;;
39
+ ;+;+;+;
40
+
41
+ puts code.boolfuck
42
+ ```
43
+ This gem adds string refinements. You can use the `boolfuck` method directly on a string:
44
+ ```ruby
45
+ require 'esolang'
46
+ using Esolang::Refinements
47
+
48
+ code.boolfuck('user_input')
49
+ ```
50
+ Alternatively, you can use the `Esolang` module:
51
+ ```ruby
52
+ require 'esolang'
53
+
54
+ Esolang.boolfuck(code, input)
55
+ ```
@@ -0,0 +1,339 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Esolang::Interpreters::BaseInterpreter
8
+
9
+ &mdash; Documentation by YARD 0.9.34
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "Esolang::Interpreters::BaseInterpreter";
19
+ relpath = '../../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../../_index.html">Index (B)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../Esolang.html" title="Esolang (module)">Esolang</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Interpreters.html" title="Esolang::Interpreters (module)">Interpreters</a></span></span>
41
+ &raquo;
42
+ <span class="title">BaseInterpreter</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Esolang::Interpreters::BaseInterpreter
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Esolang::Interpreters::BaseInterpreter</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/interpreters/base_interpreter.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>The BaseInterpreter class provides a common interface and basic functionality for interpreting esoteric programming languages.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div><div id="subclasses">
114
+ <h2>Direct Known Subclasses</h2>
115
+ <p class="children"><span class='object_link'><a href="Boolfuck.html" title="Esolang::Interpreters::Boolfuck (class)">Boolfuck</a></span>, <span class='object_link'><a href="Brainfuck.html" title="Esolang::Interpreters::Brainfuck (class)">Brainfuck</a></span>, <span class='object_link'><a href="Paintfuck.html" title="Esolang::Interpreters::Paintfuck (class)">Paintfuck</a></span>, <span class='object_link'><a href="Smallfuck.html" title="Esolang::Interpreters::Smallfuck (class)">Smallfuck</a></span></p>
116
+ </div>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <h2>
126
+ Instance Method Summary
127
+ <small><a href="#" class="summary_toggle">collapse</a></small>
128
+ </h2>
129
+
130
+ <ul class="summary">
131
+
132
+ <li class="public ">
133
+ <span class="summary_signature">
134
+
135
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(code) &#x21d2; BaseInterpreter </a>
136
+
137
+
138
+
139
+ </span>
140
+
141
+
142
+ <span class="note title constructor">constructor</span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ <span class="summary_desc"><div class='inline'>
152
+ <p>Initializes a new instance of the BaseInterpreter class.</p>
153
+ </div></span>
154
+
155
+ </li>
156
+
157
+
158
+ <li class="public ">
159
+ <span class="summary_signature">
160
+
161
+ <a href="#run-instance_method" title="#run (instance method)">#<strong>run</strong> &#x21d2; Object </a>
162
+
163
+
164
+
165
+ </span>
166
+
167
+
168
+
169
+
170
+ <span class="abstract note title">abstract</span>
171
+
172
+
173
+
174
+
175
+ <span class="summary_desc"><div class='inline'>
176
+ <p>Executes the interpretation of the code.</p>
177
+ </div></span>
178
+
179
+ </li>
180
+
181
+
182
+ </ul>
183
+
184
+
185
+ <div id="constructor_details" class="method_details_list">
186
+ <h2>Constructor Details</h2>
187
+
188
+ <div class="method_details first">
189
+ <h3 class="signature first" id="initialize-instance_method">
190
+
191
+ #<strong>initialize</strong>(code) &#x21d2; <tt><span class='object_link'><a href="" title="Esolang::Interpreters::BaseInterpreter (class)">BaseInterpreter</a></span></tt>
192
+
193
+
194
+
195
+
196
+
197
+ </h3><div class="docstring">
198
+ <div class="discussion">
199
+
200
+ <p>Initializes a new instance of the BaseInterpreter class.</p>
201
+
202
+
203
+ </div>
204
+ </div>
205
+ <div class="tags">
206
+ <p class="tag_title">Parameters:</p>
207
+ <ul class="param">
208
+
209
+ <li>
210
+
211
+ <span class='name'>code</span>
212
+
213
+
214
+ <span class='type'>(<tt>String</tt>)</span>
215
+
216
+
217
+
218
+ &mdash;
219
+ <div class='inline'>
220
+ <p>The code to interpret.</p>
221
+ </div>
222
+
223
+ </li>
224
+
225
+ </ul>
226
+
227
+
228
+ </div><table class="source_code">
229
+ <tr>
230
+ <td>
231
+ <pre class="lines">
232
+
233
+
234
+ 11
235
+ 12
236
+ 13
237
+ 14
238
+ 15
239
+ 16</pre>
240
+ </td>
241
+ <td>
242
+ <pre class="code"><span class="info file"># File 'lib/interpreters/base_interpreter.rb', line 11</span>
243
+
244
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_code'>code</span><span class='rparen'>)</span>
245
+ <span class='ivar'>@code</span> <span class='op'>=</span> <span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_chars'>chars</span>
246
+ <span class='ivar'>@code_pointer</span> <span class='op'>=</span> <span class='int'>0</span>
247
+ <span class='ivar'>@loop_map</span> <span class='op'>=</span> <span class='id identifier rubyid_create_loop_map'>create_loop_map</span>
248
+ <span class='ivar'>@tape_pointer</span> <span class='op'>=</span> <span class='int'>0</span>
249
+ <span class='kw'>end</span></pre>
250
+ </td>
251
+ </tr>
252
+ </table>
253
+ </div>
254
+
255
+ </div>
256
+
257
+
258
+ <div id="instance_method_details" class="method_details_list">
259
+ <h2>Instance Method Details</h2>
260
+
261
+
262
+ <div class="method_details first">
263
+ <h3 class="signature first" id="run-instance_method">
264
+
265
+ #<strong>run</strong> &#x21d2; <tt>Object</tt>
266
+
267
+
268
+
269
+
270
+
271
+ </h3><div class="docstring">
272
+ <div class="discussion">
273
+ <div class="note abstract">
274
+ <strong>This method is abstract.</strong>
275
+ <div class='inline'>
276
+ <p>Subclasses must implement the run method.</p>
277
+ </div>
278
+ </div>
279
+
280
+ <p>Executes the interpretation of the code. Subclasses must implement this method.</p>
281
+
282
+
283
+ </div>
284
+ </div>
285
+ <div class="tags">
286
+
287
+ <p class="tag_title">Raises:</p>
288
+ <ul class="raise">
289
+
290
+ <li>
291
+
292
+
293
+ <span class='type'>(<tt>NotImplementedError</tt>)</span>
294
+
295
+
296
+
297
+ &mdash;
298
+ <div class='inline'>
299
+ <p>Raised if the method is not implemented by subclasses.</p>
300
+ </div>
301
+
302
+ </li>
303
+
304
+ </ul>
305
+
306
+ </div><table class="source_code">
307
+ <tr>
308
+ <td>
309
+ <pre class="lines">
310
+
311
+
312
+ 22
313
+ 23
314
+ 24</pre>
315
+ </td>
316
+ <td>
317
+ <pre class="code"><span class="info file"># File 'lib/interpreters/base_interpreter.rb', line 22</span>
318
+
319
+ <span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
320
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Subclasses must implement the run method</span><span class='tstring_end'>&#39;</span></span>
321
+ <span class='kw'>end</span></pre>
322
+ </td>
323
+ </tr>
324
+ </table>
325
+ </div>
326
+
327
+ </div>
328
+
329
+ </div>
330
+
331
+ <div id="footer">
332
+ Generated on Mon Jan 22 14:49:08 2024 by
333
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
334
+ 0.9.34 (ruby-3.1.2).
335
+ </div>
336
+
337
+ </div>
338
+ </body>
339
+ </html>