functional_brainruby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +34 -15
- data/lib/functional_brainruby/generator.rb +1 -2
- data/lib/functional_brainruby/version.rb +1 -1
- data/views/template.erb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc178e2fabe162a11455f6571c29962cb73e29c0f954bf43df20270706ed56c8
|
4
|
+
data.tar.gz: d6fe9a54a34228b375a6c4ea0f48ffa8efcf085c227f6f7e13452999ee1a3736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47657bd9b06adec85ae67c9a4f343b0f9fcc01acf6ca3f848edae4aa7d73a4ae8111e78c47c947374d3007339541ebfa8ae4871a1f4c3399f0d98be6b2ccfb3
|
7
|
+
data.tar.gz: 2c27e47fea3baec1156c68886482a8ddf3681e876fab092b32149af02f9bd45400c8a76a54e14d6e01b8f69e7cd58510b07ce6c2bd01a03278793c1fd57d9bbe
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,47 @@
|
|
1
|
-
#
|
1
|
+
# Functional Brainruby
|
2
2
|
|
3
|
-
Welcome to
|
3
|
+
Welcome to Functional Brainruby, the esoteric programming language which is basically just Ruby.
|
4
4
|
|
5
|
-
|
5
|
+
Using Functional Brainruby, you can write any Ruby program using just 14 non-alphanumeric characters:
|
6
6
|
|
7
|
-
|
7
|
+
```
|
8
|
+
-<>&_{}[]\",=:#
|
9
|
+
```
|
10
|
+
|
11
|
+
See the [`examples`](https://github.com/amcaplan/functional_brainruby/tree/main/examples) directory for Hello World and Fizzbuzz programs written in Functional Brainruby.
|
12
|
+
|
13
|
+
You shouldn't try to write Functional Brainruby yourself. The compiler will do the hard work for you, turning your Ruby code into Functional Brainruby code. To compile, run the generator with 2 arguments:
|
14
|
+
|
15
|
+
1. The name of the file to compile
|
16
|
+
2. The name of the output file
|
17
|
+
|
18
|
+
For example:
|
8
19
|
|
9
|
-
|
20
|
+
``` sh
|
21
|
+
functional_brainruby /path/to/some/file.rb /path/to/output/file.rb
|
22
|
+
```
|
23
|
+
|
24
|
+
You can then run the output file as usual:
|
10
25
|
|
11
|
-
```
|
12
|
-
|
26
|
+
``` sh
|
27
|
+
ruby /path/to/output/file.rb
|
13
28
|
```
|
14
29
|
|
15
|
-
|
30
|
+
Explanation coming soon...
|
16
31
|
|
17
|
-
|
32
|
+
That's it! Have fun!
|
18
33
|
|
19
|
-
|
34
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/functional_brainruby`. To experiment with that code, run `bin/console` for an interactive prompt.
|
20
35
|
|
21
|
-
|
36
|
+
TODO: Delete this and the text above, and describe your gem
|
22
37
|
|
23
|
-
##
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
Do not under any circumstances add this line to a Gemfile!
|
24
41
|
|
25
|
-
|
42
|
+
Install it yourself as:
|
43
|
+
|
44
|
+
$ gem install functional_brainruby
|
26
45
|
|
27
46
|
## Development
|
28
47
|
|
@@ -32,7 +51,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
51
|
|
33
52
|
## Contributing
|
34
53
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/amcaplan/functional_brainruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/amcaplan/functional_brainruby/blob/main/CODE_OF_CONDUCT.md).
|
36
55
|
|
37
56
|
|
38
57
|
## License
|
@@ -41,4 +60,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
41
60
|
|
42
61
|
## Code of Conduct
|
43
62
|
|
44
|
-
Everyone interacting in the FunctionalBrainruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
63
|
+
Everyone interacting in the FunctionalBrainruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/amcaplan/functional_brainruby/blob/master/CODE_OF_CONDUCT.md).
|
@@ -5,7 +5,6 @@ require 'erb'
|
|
5
5
|
module FunctionalBrainruby
|
6
6
|
class Generator
|
7
7
|
ONE = "[[]]<=>[]"
|
8
|
-
NEGATIVE_ONE = "[]<=>[[]]"
|
9
8
|
TEMPLATE = ERB.new(File.read(File.join(File.dirname(__FILE__), '../../views/template.erb')))
|
10
9
|
|
11
10
|
def initialize(string)
|
@@ -29,7 +28,7 @@ module FunctionalBrainruby
|
|
29
28
|
if index == 0
|
30
29
|
"__[#{ONE}]"
|
31
30
|
else
|
32
|
-
"#{index.times.map { "_[" }.join}#{ONE}#{index.times.map { ",#{
|
31
|
+
"#{index.times.map { "_[" }.join}#{ONE}#{index.times.map { ",#{ONE}]" }.join}"
|
33
32
|
end
|
34
33
|
end
|
35
34
|
}.compact.join('--') + "]"
|
data/views/template.erb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
->&_{->__{->____{
|
1
|
+
->&_{->__{->&___{->____{___[___["",____,""<<__[_[_[[[]]<=>[],[[]]<=>[]],[[]]<=>[]]--_[_[_[_[[[]]<=>[],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]]--_[_[_[_[_[_[[[]]<=>[],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]]]<<__[__[[[]]<=>[]]--_[[[]]<=>[],[[]]<=>[]]--_[_[[[]]<=>[],[[]]<=>[]],[[]]<=>[]]--_[_[_[[[]]<=>[],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]]--_[_[_[_[_[_[[[]]<=>[],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]],[[]]<=>[]]]<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@@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functional_brainruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariel Caplan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Now with more functions!
|
14
14
|
email:
|