From 5bc82ef007d32f21c1bb754ceea929e4ecc77c41 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Sat, 31 Dec 2022 12:37:59 +0100 Subject: [PATCH 01/15] Fix overflow when the scope is pop while the index is 0 and add a test for it --- src/evaluation/evaluator.rs | 9 +++++++++ src/evaluation/scope.rs | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/evaluation/evaluator.rs b/src/evaluation/evaluator.rs index e81fca1..86a87ab 100644 --- a/src/evaluation/evaluator.rs +++ b/src/evaluation/evaluator.rs @@ -204,4 +204,13 @@ mod tests { brainfuck.evaluate(None, Some(false)); assert_eq!(String::from_utf8(brainfuck.output_buffer).unwrap(), "AA"); } + + #[test] + fn test_overflow_scope_pop() { + let program = String::from("{ยด}="); + let mut parser = ast::Parser::new(program); + let instructions = parser.parse(); + let mut evaluator = Evaluator::new(instructions); + evaluator.evaluate(None, Some(false)); + } } diff --git a/src/evaluation/scope.rs b/src/evaluation/scope.rs index 94f7ced..e1c5b21 100644 --- a/src/evaluation/scope.rs +++ b/src/evaluation/scope.rs @@ -136,7 +136,9 @@ where pub fn pop(&mut self) { self.scopes.pop(); - self.scope_index -= 1; + if self.scope_index > 0 { + self.scope_index -= 1; + } } } From 22059f147e1d8590080002efcbea656c1d8a51d5 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Sat, 31 Dec 2022 13:17:08 +0100 Subject: [PATCH 02/15] Fix input multiple chars --- src/evaluation/evaluator.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/evaluation/evaluator.rs b/src/evaluation/evaluator.rs index 86a87ab..e955e2a 100644 --- a/src/evaluation/evaluator.rs +++ b/src/evaluation/evaluator.rs @@ -5,8 +5,8 @@ use crate::ast::{InstructionTrait, InstructionType, PatternType}; use crate::evaluation::{Cell, Scopes}; pub struct Evaluator> -where - T: Clone, + where + T: Clone, { program: Vec, @@ -17,8 +17,8 @@ where } impl + 'static> Evaluator -where - T: Clone, + where + T: Clone, { pub fn new(instructions: Vec) -> Evaluator { Evaluator { @@ -58,15 +58,17 @@ where } InstructionType::Input => { - if self.input.is_empty() { - let mut input = String::new(); - std::io::stdin().read_line(&mut input).unwrap(); - // Convert the input to a vector of u8 - self.input = input.trim().bytes().collect(); + for _ in 0..instruction.get_amount() { + if self.input.is_empty() { + let mut input = String::new(); + std::io::stdin().read_line(&mut input).unwrap(); + // Convert the input to a vector of u8 + self.input = input.trim().bytes().collect(); + } + self.scopes + .get_current_cell_mut() + .set_value(self.input.remove(0)); } - self.scopes - .get_current_cell_mut() - .set_value(self.input.remove(0)); } InstructionType::Output => { for _ in 0..instruction.get_amount() { From 03800f38a42a0238d2782b1a83d7d1cb79f57e73 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Mon, 2 Jan 2023 10:27:34 +0100 Subject: [PATCH 03/15] Fix error when no input is given --- src/evaluation/evaluator.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/evaluation/evaluator.rs b/src/evaluation/evaluator.rs index e955e2a..647cc24 100644 --- a/src/evaluation/evaluator.rs +++ b/src/evaluation/evaluator.rs @@ -65,9 +65,14 @@ impl + 'static> Evaluator // Convert the input to a vector of u8 self.input = input.trim().bytes().collect(); } - self.scopes - .get_current_cell_mut() - .set_value(self.input.remove(0)); + + if self.input.is_empty() { + self.scopes.get_current_cell_mut().set_value(0); + } else { + self.scopes + .get_current_cell_mut() + .set_value(self.input.remove(0)); + } } } InstructionType::Output => { From c2fcd3b504d8b390bb7bb7686a39961e0fc885c3 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Fri, 30 Dec 2022 16:06:02 +0100 Subject: [PATCH 04/15] Add the README and the logo --- README.md | 172 ++++++++++++++++++++++++++++++++++++++++++++++++ assets/logo.png | Bin 0 -> 19138 bytes 2 files changed, 172 insertions(+) create mode 100644 README.md create mode 100644 assets/logo.png diff --git a/README.md b/README.md new file mode 100644 index 0000000..997d91a --- /dev/null +++ b/README.md @@ -0,0 +1,172 @@ +
+ + +[![Contributors][contributors-shield]][contributors-url] +[![Forks][forks-shield]][forks-url] +[![Stargazers][stars-shield]][stars-url] +[![Issues][issues-shield]][issues-url] +[![MIT License][license-shield]][license-url] + + + + +
+
+ + Logo + + + ### FuckBrainfuck + [Explore documentation](https://github.com/Sellig6792/FuckBrainfuck/wiki) | [Report Bug](https://github.com/Sellig6792/FuckBrainfuck/issues) | [Request Feature](https://Sellig6792/FuckBrainfuck/issues) +
+
+ + + + +1. [About the Project](#about-the-project) +2. [Installation](#installation) + - [Prebuilt Binaries](#1-prebuilt-binaries) + - [Building from Source](#2-building-from-source) +3. [Usage](#usage) +4. [Contributing](#contributing) +5. [License](#license) +6. [Contact](#contact) +7. [Acknowledgements](#acknowledgements) + + + + + + +## About The Project + +It all started on the Discord server of Graven, on 26th June 2022. +It was a joke that ended up on this shit... + +So FuckBrainfuck was born. It is an improvement of the classic BrainFuck, with some new features and new commands. + +We have already implemented: + +- Functions +- "Safe" comments +- Scopes for functions +- Optimization + + + +### Built With +![Rust][rust-shield] ![Cargo][cargo-shield] + +

(back to top)

+ + + +## Installation + +### 1. Prebuilt binaries + +You can download the prebuilt binaries from the [releases page](https://github.com/Sellig6792/FuckBrainfuck/releases). +If your system is not supported, you can [build it yourself](#2-building-from-source). + +### 2. Building from source + +You need to have [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) installed. + +```sh +git clone https://github.com/Sellig6792/FuckBrainfuck.git +cd FuckBrainfuck +cargo build --release +``` + +

(back to top)

+ + + +## Usage +``` +fbf [OPTIONS] +``` + +### Options +`-O, --optimize` Optimize the code before executing it + +`-V, --version` Prints version information + +`-h, --help` Prints help information + + + +[//]: # (

(back to top)

) + + + +## Contributing + +Contributions are what make the open source community such an amazing place to learn, inspire, and create. +Any contributions you make are **greatly appreciated**. + +If you have a suggestion that would make this better, please fork the repo and create a pull request. +You can also simply open an issue with the tag "enhancement". +Don't forget to give the project a star! Thanks again! + +1. Fork the Project +2. Checkout the develop branch: `git checkout develop` +3. Create your Feature Branch: `git branch feat/AmazingFeature` +4. Commit your Changes: `git commit -m 'Add some AmazingFeature'` +5. Push to the Branch: `git push origin feat/AmazingFeature` +6. Open a Pull Request to the develop branch and explain your changes + + + + +## License + +Distributed under the MIT License. See [the licence](./LICENSE) for more information. + +

(back to top)

+ + + + +## Contact + +Sellig6792 - [@Sellig6792](https://twitter.com/Sellig6792) - sellig6792@gmail.com + + +

(back to top)

+ + + + +## Acknowledgements + +* [Wikipedia - Brainfuck][wikipedia-brainfuck-url] +* [Astremy - Brainfuck Course (French)][astremy-brainfuck-pdf] +

(back to top)

+ + + + +[contributors-shield]: https://img.shields.io/github/contributors/Sellig6792/FuckBrainfuck.svg?style=for-the-badge +[contributors-url]: https://github.com/Sellig6792/FuckBrainfuck/graphs/contributors + +[forks-shield]: https://img.shields.io/github/forks/Sellig6792/FuckBrainfuck.svg?style=for-the-badge +[forks-url]: https://github.com/Sellig6792/FuckBrainfuck/network/members + +[stars-shield]: https://img.shields.io/github/stars/Sellig6792/FuckBrainfuck.svg?style=for-the-badge +[stars-url]: https://github.com/Sellig6792/FuckBrainfuck/stargazers + +[issues-shield]: https://img.shields.io/github/issues/Sellig6792/FuckBrainfuck.svg?style=for-the-badge +[issues-url]: https://github.com/Sellig6792/FuckBrainfuck/issues + +[license-shield]: https://img.shields.io/github/license/Sellig6792/FuckBrainfuck.svg?style=for-the-badge +[license-url]: https://github.com/Sellig6792/FuckBrainfuck/blob/main/LICENSE +[rust-shield]: https://img.shields.io/badge/-rust-black.svg?style=for-the-badge&logo=rust&colorB=555 +[cargo-shield]: https://img.shields.io/badge/-cargo-black.svg?style=for-the-badge&logo=rust&colorB=555 +[brainFuck-url]: https://en.wikipedia.org/wiki/Brainfuck +[brainFuck-shield]: https://img.shields.io/badge/-BrainFuck-black.svg?style=for-the-badge&logo=brainfuck&colorB=555 + +[graven-discord-url]: https://discord.gg/graven +[astremy-brainfuck-pdf]: https://cdn.discordapp.com/attachments/815331771197030441/824402769397940234/brainfuck.pdf +[wikipedia-brainfuck-url]: https://en.wikipedia.org/wiki/Brainfuck \ No newline at end of file diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b08d9930555dd9e53771d7ef04546967813f86ab GIT binary patch literal 19138 zcmZsDWn7d`_xA!KAgQDvC7?*Bl!S@63Q9_>w3O1F(j5X)QVS@!(jnnW!%9fI zz|!%|^84NY`+o7f;Pct*n(Lf7Gv~~iGv|ATFl|jG(rfhBAP@+tin4+(1cD0%e@_Xo zf;Xl*4yF)@YM6?`Lwy)@b0*B2%BJ}oeWdq1nkmWn*3e%D1$LH_hd9Ri_pe8OyiP%K zRe*&hVoE&Yw@~;=Am>EN*5FSSAAih!k3SEz_{V4JTMgz;nq^Yb3(A_y%3GYu%jS+d znF(3hJ5tqJzwc!V6|H;{Y`L$GtnN?sKd+YdU~+A<@tD{bgvC6Tk&!244USc?tyV}P z9!MrL4={UY|LY_(@FJ$;Bh2i za&$IkiS&qm!7AxtQG0T$_zn?kur;e$eu%=+8NFar_6@*Y(-vKleEJ11{(ZhB;Ay62 z=e8p9*+=418A17rx0G3@rO z30y8`cF?KvaPBJ{8Ex!mb?GAw*PG;+UPSqB{@qjtokevFlgoX9BNKfx0acH)YVi#{ zpSaWMgua12wW)!{uPKx^Yva&a+<_d{R+n2iLwK~hpa;m4BYVA#LFTjy)KC&!8ak`vl;}f~m)};ZmkHq{1 zUJq3mOi>Xj;jjhAIzQvX*zN=#*=oZl#opAZIT(q5X%mBOU*GW!0%}aibv{x;U;F;; zNT%Llf$$m~&?n6`qg_tu*PHDy6$cCPU|e9+=kg2oj0o;0Rw-3w4kTULUkF(XJQ`oL zNmEtLYrqk9UHbF4edGz7Xs;Owa6%V2-I(>K=%e!juFKclx++6TgW!HJ>ixN7lk}Y+ z1ve|ZTCQ^lTO>;K?{Dp%r#(40PyN1-_f-NhE^3o%aV*H7le+Jzrk%nAj~`doF4N|k!_ zxc;<&?$G5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tUURnG*?9=dy$$cg11QHF_@@ouCIk+-0u-K6=*ugocVa9cH{Px{ z60#a!!zYpB;WP`5<#|W^7e^tGc!h{{5z6@#BL8sVc5v+40z)hWw^Ix-{$>H*nkZu5 z{*=eTn`a1#ppXwF0`wYGd|*ucX2Ik+!4dy2{Q(00<_RGrx=_G?jG}N6LP&gJAXXqF z82FSBLXs2i1qq}S_fjN;kmRORz_<_}aGQM%Q@98r#GRP;E|#tZQE%t~lFPnkz1OaM zJrhC*aVVy1yMBWQkR0A?RK9KrA%r*{({q^9kU&z{*P{2Dl&@1l2q7s9--ZNY!nYF% zAtbxuC>Rg{j&2b`2$A7hFd$%DyF~~gq)|%Wh}_blKSTgDW?wseGm#KNNGmCwiey*{ zpg#K=;Z!0agpeRZ2?Hunwg@4FL={HJMgy}Nn!UzuGb=j5R!!~9u4CHeMH6X zYaG=ggb+f!B6g{_bPqfAVF|Ru?o-~rCHFT%2qA=2WU+{GL=1k}eTAY$2qA>DpVFyG zt`S3}->=c))FB~+5E4O5-zkoYWkvaDmiL^?{eTcc2q7_rGL{0AEJ6q&#NCvx7qh3N zxOhK#>~mtD8?MVDgb+f~ol+sQBkkJ{f36)1kKML*8{2J7!6JkZLWoSMl$B3ga-^)W z@^-S@jB-T?A%u{iqsmzt?@?*jiBd%fA%qYYvsl*3r#Pz#;)?<03)HKz%cevTLSo4O Y2c9PP&@nOt=l}o!07*qoM6N<$g355K+5i9m literal 0 HcmV?d00001 From 95c746b8e3b219c00e4193c3bd35cea168257e13 Mon Sep 17 00:00:00 2001 From: Gamingdy Date: Fri, 30 Dec 2022 21:11:55 +0100 Subject: [PATCH 05/15] Readme review --- README.md | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 997d91a..84c00a7 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ [![MIT License][license-shield]][license-url] -
@@ -17,12 +16,11 @@ ### FuckBrainfuck - [Explore documentation](https://github.com/Sellig6792/FuckBrainfuck/wiki) | [Report Bug](https://github.com/Sellig6792/FuckBrainfuck/issues) | [Request Feature](https://Sellig6792/FuckBrainfuck/issues) + [Explore documentation][wiki] | [Report Bug][issues] | [Request Feature][issues]

- 1. [About the Project](#about-the-project) 2. [Installation](#installation) @@ -35,25 +33,22 @@ 7. [Acknowledgements](#acknowledgements) - - - ## About The Project -It all started on the Discord server of Graven, on 26th June 2022. +It all started on Graven's Discord server on June 26, 2022. It was a joke that ended up on this shit... So FuckBrainfuck was born. It is an improvement of the classic BrainFuck, with some new features and new commands. -We have already implemented: - -- Functions -- "Safe" comments -- Scopes for functions -- Optimization +Already implemented: +- [Functions][wiki-function] +- ["Safe" comments][wiki-comment] +- [Scopes for functions][wiki-scope] +- [Optimization][wiki-optimisation] +

(back to top)

### Built With ![Rust][rust-shield] ![Cargo][cargo-shield] @@ -61,12 +56,11 @@ We have already implemented:

(back to top)

- ## Installation ### 1. Prebuilt binaries -You can download the prebuilt binaries from the [releases page](https://github.com/Sellig6792/FuckBrainfuck/releases). +You can download the prebuilt binaries from the [releases page][release]. If your system is not supported, you can [build it yourself](#2-building-from-source). ### 2. Building from source @@ -88,6 +82,8 @@ cargo build --release fbf [OPTIONS] ``` +

(back to top)

+ ### Options `-O, --optimize` Optimize the code before executing it @@ -95,9 +91,7 @@ fbf [OPTIONS] `-h, --help` Prints help information - - -[//]: # (

(back to top)

) +

(back to top)

@@ -106,7 +100,7 @@ fbf [OPTIONS] Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. -If you have a suggestion that would make this better, please fork the repo and create a pull request. +If you have a suggestion that could make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again! @@ -117,32 +111,31 @@ Don't forget to give the project a star! Thanks again! 5. Push to the Branch: `git push origin feat/AmazingFeature` 6. Open a Pull Request to the develop branch and explain your changes +

(back to top)

## License -Distributed under the MIT License. See [the licence](./LICENSE) for more information. +Distributed under the MIT License. See [the licence](LICENSE) for more information.

(back to top)

- ## Contact Sellig6792 - [@Sellig6792](https://twitter.com/Sellig6792) - sellig6792@gmail.com -

(back to top)

- ## Acknowledgements * [Wikipedia - Brainfuck][wikipedia-brainfuck-url] * [Astremy - Brainfuck Course (French)][astremy-brainfuck-pdf] +

(back to top)

@@ -169,4 +162,15 @@ Sellig6792 - [@Sellig6792](https://twitter.com/Sellig6792) - sellig6792@gmail.co [graven-discord-url]: https://discord.gg/graven [astremy-brainfuck-pdf]: https://cdn.discordapp.com/attachments/815331771197030441/824402769397940234/brainfuck.pdf -[wikipedia-brainfuck-url]: https://en.wikipedia.org/wiki/Brainfuck \ No newline at end of file +[wikipedia-brainfuck-url]: https://en.wikipedia.org/wiki/Brainfuck + +[wiki]: https://github.com/Sellig6792/FuckBrainfuck/wiki + +[wiki-function]: https://github.com/Sellig6792/FuckBrainfuck/wiki#functions +[wiki-optimisation]: https://github.com/Sellig6792/FuckBrainfuck/wiki#optimisation +[wiki-scope]: https://github.com/Sellig6792/FuckBrainfuck/wiki#scope +[wiki-comment]: https://github.com/Sellig6792/FuckBrainfuck/wiki#comments + + +[issues]: https://github.com/Sellig6792/FuckBrainfuck/issues +[release]: https://github.com/Sellig6792/FuckBrainfuck/releases From 28562a4a5832c3d8b6eb6ffbee87d8dd0b29558d Mon Sep 17 00:00:00 2001 From: Gamingdy Date: Fri, 30 Dec 2022 21:15:24 +0100 Subject: [PATCH 06/15] delete useless line in readme --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 84c00a7..b64e78e 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,6 @@ cargo build --release fbf [OPTIONS] ``` -

(back to top)

### Options `-O, --optimize` Optimize the code before executing it From 76518cf167a8d7f7671fb75368bbbb3266f264e7 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 12:57:18 +0100 Subject: [PATCH 07/15] tell contributors they can use fix/... for a fix instead of feat/... --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b64e78e..e000f74 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ Don't forget to give the project a star! Thanks again! 1. Fork the Project 2. Checkout the develop branch: `git checkout develop` -3. Create your Feature Branch: `git branch feat/AmazingFeature` -4. Commit your Changes: `git commit -m 'Add some AmazingFeature'` -5. Push to the Branch: `git push origin feat/AmazingFeature` +3. Create your Branch (feature or fix): `git checkout -b [feature/fix]/[name]` +4. Commit your Changes: `git commit -m 'Add some [...]` +5. Push to the Branch: `git push origin [feature/fix]/[name]` 6. Open a Pull Request to the develop branch and explain your changes

(back to top)

From 8b6a54723317e167f98c6bacb33ecb8e857b1b41 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Sat, 31 Dec 2022 12:52:17 +0100 Subject: [PATCH 08/15] Add comments between two # --- src/ast/parser.rs | 10 ++++++++++ src/evaluation/evaluator.rs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/ast/parser.rs b/src/ast/parser.rs index 4b4688f..33627f8 100644 --- a/src/ast/parser.rs +++ b/src/ast/parser.rs @@ -23,6 +23,7 @@ impl Parser { fn _parse(&self, index: Option, stop_char: Option) -> (Vec, usize) { let mut index = index.unwrap_or(0); let mut instructions = vec![]; + let mut comment = false; while index < self.program.len() { let char = match self.program.chars().nth(index) { @@ -33,6 +34,15 @@ impl Parser { return (instructions, index); } + if char == '#' { + comment = !comment; + } + + if comment { + index += 1; + continue; + } + match char { '+' => instructions.push(Instruction::new(InstructionType::Increment, None)), '-' => instructions.push(Instruction::new(InstructionType::Decrement, None)), diff --git a/src/evaluation/evaluator.rs b/src/evaluation/evaluator.rs index 647cc24..1271cf8 100644 --- a/src/evaluation/evaluator.rs +++ b/src/evaluation/evaluator.rs @@ -220,4 +220,14 @@ mod tests { let mut evaluator = Evaluator::new(instructions); evaluator.evaluate(None, Some(false)); } + + #[test] + fn test_comments() { + let program = String::from("++++++[>++++++++<-]>#+#."); + let mut parser = ast::Parser::new(program); + let instructions = parser.parse(); + let mut evaluator = Evaluator::new(instructions); + evaluator.evaluate(None, Some(false)); + assert_eq!(String::from_utf8(evaluator.output_buffer).unwrap(), "0"); + } } From df7598994a179f61303777b31d1ae706411b18e8 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 13:16:34 +0100 Subject: [PATCH 09/15] Format the project --- src/evaluation/evaluator.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/evaluation/evaluator.rs b/src/evaluation/evaluator.rs index 1271cf8..d571b51 100644 --- a/src/evaluation/evaluator.rs +++ b/src/evaluation/evaluator.rs @@ -5,8 +5,8 @@ use crate::ast::{InstructionTrait, InstructionType, PatternType}; use crate::evaluation::{Cell, Scopes}; pub struct Evaluator> - where - T: Clone, +where + T: Clone, { program: Vec, @@ -17,8 +17,8 @@ pub struct Evaluator> } impl + 'static> Evaluator - where - T: Clone, +where + T: Clone, { pub fn new(instructions: Vec) -> Evaluator { Evaluator { @@ -160,7 +160,9 @@ impl + 'static> Evaluator } match show_output { - None | Some(true) => println!("{}", String::from_utf8(self.output_buffer.clone()).unwrap()), + None | Some(true) => { + println!("{}", String::from_utf8(self.output_buffer.clone()).unwrap()) + } _ => (), } } From d853d110a7e68f7f417616577d7c52ed58b44b72 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 13:19:01 +0100 Subject: [PATCH 10/15] Clippy fixes --- src/ast/parser.rs | 9 +++------ src/evaluation/cell.rs | 2 +- src/evaluation/evaluator.rs | 6 +++--- src/evaluation/scope.rs | 2 +- src/main.rs | 2 +- src/optimization/optimizer.rs | 8 ++++---- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/ast/parser.rs b/src/ast/parser.rs index 33627f8..29c3582 100644 --- a/src/ast/parser.rs +++ b/src/ast/parser.rs @@ -7,17 +7,14 @@ pub struct Parser { impl Parser { pub fn new(program: String) -> Parser { let program = program - .replace(' ', "") - .replace('\t', "") - .replace('\r', "") - .replace('\n', ""); + .replace([' ', '\t', '\r', '\n'], ""); Parser { program } } pub fn parse(&mut self) -> Vec { let (instructions, _) = self._parse(None, None); - return instructions; + instructions } fn _parse(&self, index: Option, stop_char: Option) -> (Vec, usize) { @@ -99,6 +96,6 @@ impl Parser { index += 1; } - return (instructions, index); + (instructions, index) } } diff --git a/src/evaluation/cell.rs b/src/evaluation/cell.rs index ba5780c..6015534 100644 --- a/src/evaluation/cell.rs +++ b/src/evaluation/cell.rs @@ -28,7 +28,7 @@ impl Cell { pub fn sub(&mut self, value: T) { let sub: isize = self.value as isize - value.to_isize().unwrap(); self.value = if sub < 0 { - u8::MAX - (sub.abs() as u8 - 1) + u8::MAX - (sub.unsigned_abs() as u8 - 1) } else { sub as u8 }; diff --git a/src/evaluation/evaluator.rs b/src/evaluation/evaluator.rs index d571b51..6a14b95 100644 --- a/src/evaluation/evaluator.rs +++ b/src/evaluation/evaluator.rs @@ -179,7 +179,7 @@ mod tests { let program = String::from("++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>."); let mut parser = ast::Parser::new(program); let instructions = parser.parse(); - let mut optimizer = optimization::Optimizer::new(instructions.clone()); + let mut optimizer = optimization::Optimizer::new(instructions); let optimized_instructions = optimizer.optimize(); let mut brainfuck = Evaluator::new(optimized_instructions); brainfuck.evaluate(None, Some(false)); @@ -195,7 +195,7 @@ mod tests { let program = String::from("{++++[>++++++++++++<-]>.}{++++[>++++++++++++<-]>+.}="); let mut parser = ast::Parser::new(program); let instructions = parser.parse(); - let mut optimizer = optimization::Optimizer::new(instructions.clone()); + let mut optimizer = optimization::Optimizer::new(instructions); let optimized_instructions = optimizer.optimize(); let mut brainfuck = Evaluator::new(optimized_instructions); brainfuck.evaluate(None, Some(false)); @@ -207,7 +207,7 @@ mod tests { let program = String::from("{+++++[>+++++++++++++<-]>.<}=="); let mut parser = ast::Parser::new(program); let instructions = parser.parse(); - let mut optimizer = optimization::Optimizer::new(instructions.clone()); + let mut optimizer = optimization::Optimizer::new(instructions); let optimized_instructions = optimizer.optimize(); let mut brainfuck = Evaluator::new(optimized_instructions); brainfuck.evaluate(None, Some(false)); diff --git a/src/evaluation/scope.rs b/src/evaluation/scope.rs index e1c5b21..fb813be 100644 --- a/src/evaluation/scope.rs +++ b/src/evaluation/scope.rs @@ -81,7 +81,7 @@ where let sub: isize = self.index as isize - amount as isize; self.index = if sub < 0 { - 30000 - (sub.abs() as usize) + 30000 - sub.unsigned_abs() } else { sub as usize } diff --git a/src/main.rs b/src/main.rs index ca5f6af..7cf3e6e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,7 +37,7 @@ fn main() -> Result<(), Box> { // Optimize the program if "optimize" is true if args.optimize { - let mut optimizer = optimization::Optimizer::new(instructions.clone()); + let mut optimizer = optimization::Optimizer::new(instructions); let optimized_instructions = optimizer.optimize(); // Evaluate the optimized program diff --git a/src/optimization/optimizer.rs b/src/optimization/optimizer.rs index f4fb5ec..5f0d15d 100644 --- a/src/optimization/optimizer.rs +++ b/src/optimization/optimizer.rs @@ -24,7 +24,7 @@ impl Optimizer { optimizer.optimize() } - fn merge_instructions(&self, optimized_instructions: &mut Vec) -> () { + fn merge_instructions(&self, optimized_instructions: &mut Vec) { for instruction in self.instructions.iter() { match optimized_instructions.last_mut() { Some(last_optimized_instruction) => { @@ -79,11 +79,11 @@ impl Optimizer { fn cancel_opposed_instructions( &self, optimized_instructions: &mut Vec, - ) -> () { + ) { let mut new_optimized_instructions: Vec = vec![]; for optimized_instruction in optimized_instructions.iter() { - match new_optimized_instructions.last().clone() { + match new_optimized_instructions.last() { Some(last_optimized_instruction) => { if last_optimized_instruction.is_opposed(optimized_instruction) { let last_amount = last_optimized_instruction.get_amount(); @@ -129,7 +129,7 @@ impl Optimizer { *optimized_instructions = new_optimized_instructions; } - fn recognize_patterns(&self, optimized_instructions: &mut Vec) -> () { + fn recognize_patterns(&self, optimized_instructions: &mut Vec) { let mut new_optimized_instructions: Vec = optimized_instructions.clone(); From 1eac0c9351b6f135e8cc0c63a2e188eec20ec4e9 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 13:22:59 +0100 Subject: [PATCH 11/15] Reformat after clippy fixes --- src/ast/parser.rs | 3 +-- src/optimization/optimizer.rs | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ast/parser.rs b/src/ast/parser.rs index 29c3582..a13a8bf 100644 --- a/src/ast/parser.rs +++ b/src/ast/parser.rs @@ -6,8 +6,7 @@ pub struct Parser { impl Parser { pub fn new(program: String) -> Parser { - let program = program - .replace([' ', '\t', '\r', '\n'], ""); + let program = program.replace([' ', '\t', '\r', '\n'], ""); Parser { program } } diff --git a/src/optimization/optimizer.rs b/src/optimization/optimizer.rs index 5f0d15d..25260fa 100644 --- a/src/optimization/optimizer.rs +++ b/src/optimization/optimizer.rs @@ -76,10 +76,7 @@ impl Optimizer { } } - fn cancel_opposed_instructions( - &self, - optimized_instructions: &mut Vec, - ) { + fn cancel_opposed_instructions(&self, optimized_instructions: &mut Vec) { let mut new_optimized_instructions: Vec = vec![]; for optimized_instruction in optimized_instructions.iter() { From bfe411ae82db58a8d84b90a2320d2442f7e2ff71 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 13:52:35 +0100 Subject: [PATCH 12/15] make "Test" run even if "Check Style" failed in "Feature PR" --- .github/workflows/feature_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/feature_pr.yml b/.github/workflows/feature_pr.yml index 054f201..67cdffc 100644 --- a/.github/workflows/feature_pr.yml +++ b/.github/workflows/feature_pr.yml @@ -32,7 +32,7 @@ jobs: test: name: Test - needs: [style] + if: always() runs-on: ubuntu-latest strategy: From 72b15cfbd4ed4560667d5e9187fc2cb6aedef34b Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 14:01:16 +0100 Subject: [PATCH 13/15] Change build targets and names of the uploaded files --- .github/workflows/release.yml | 72 ++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ed8b855..e57b3ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,31 +10,29 @@ env: CARGO_TERM_COLOR: always jobs: - # style: - # name: Check Style - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v1 - # - # - name: Install rust - # uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # components: rustfmt - # profile: minimal - # override: true - # - # - name: cargo fmt -- --check - # uses: actions-rs/cargo@v1 - # with: - # command: fmt - # args: --all -- --check + style: + name: Check Style + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + profile: minimal + override: true + - name: cargo fmt -- --check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check test: name: Test - # needs: [style] + if: always() runs-on: ubuntu-latest strategy: @@ -82,21 +80,26 @@ jobs: if: startsWith(github.ref, 'refs/tags/') strategy: matrix: - target: [ aarch64-unknown-linux-gnu, - armv7-unknown-linux-gnueabihf, - i686-unknown-linux-gnu, i686-unknown-linux-musl, - mips-unknown-linux-gnu, mips64-unknown-linux-gnuabi64, mips64el-unknown-linux-gnuabi64, mipsel-unknown-linux-gnu, - powerpc-unknown-linux-gnu, powerpc64-unknown-linux-gnu, powerpc64le-unknown-linux-gnu, - arm-unknown-linux-gnueabi, - x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl, x86_64-pc-windows-gnu ] - os: [ ubuntu-latest ] - - include: + os: [ ubuntu-latest ] # Default os for build + include: # List of all targets to build for and the name for common mortals + - target: aarch64-unknown-linux-gnu + name: arm64 + - target: i686-pc-windows-gnu + name: win-i686 + - target: x86_64-pc-windows-gnu + name: win-x86_64 + - target: i686-unknown-linux-gnu + name: linux-i686 + - target: x86_64-unknown-linux-gnu + name: linux-x86_64 - target: x86_64-apple-darwin + name: macos os: macos-latest + + # Runs on latest ubuntu by default except for windows targets runs-on: ${{ matrix.os }} @@ -120,16 +123,15 @@ jobs: - name: Rename binary (Linux & macOS) if: matrix.target != 'x86_64-pc-windows-gnu' - run: mv target/${{ matrix.target }}/release/fbf target/${{ matrix.target }}/release/fbf-${{ matrix.target }} + run: mv target/${{ matrix.target }}/release/fbf target/${{ matrix.target }}/release/fbf-${{ matrix.name }} - name: Rename binary (Windows) if: matrix.target == 'x86_64-pc-windows-gnu' - run: mv target/${{ matrix.target }}/release/fbf.exe target/${{ matrix.target }}/release/fbf-${{ matrix.target }}.exe + run: mv target/${{ matrix.target }}/release/fbf.exe target/${{ matrix.target }}/release/fbf-${{ matrix.name }}.exe - name: Upload release uses: softprops/action-gh-release@v1 with: - files: target/${{ matrix.target }}/release/fbf-${{ matrix.target }}* - discussion_category_name: Q&A + files: target/${{ matrix.target }}/release/fbf-${{ matrix.name }}* token: ${{ secrets.PAT_GITHUB }} From 0ad60dd88b87133b4547fb1a9114316df77786c6 Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 14:24:47 +0100 Subject: [PATCH 14/15] Update version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f9edf3..8218558 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -92,7 +92,7 @@ dependencies = [ [[package]] name = "fuckbrainfuck" -version = "0.1.0" +version = "2.1.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 6c73bbc..6a70454 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fuckbrainfuck" -version = "0.1.0" +version = "2.1.0" edition = "2021" authors = ["Sellig6792 "] description = "The improved Brainfuck" From c390801917e58e8897018cf7a32d91b10747460a Mon Sep 17 00:00:00 2001 From: Sellig6792 Date: Thu, 5 Jan 2023 14:33:42 +0100 Subject: [PATCH 15/15] fix targets --- .github/workflows/release.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e57b3ae..d705803 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -81,6 +81,13 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] # Default os for build + target: [ aarch64-unknown-linux-gnu, + i686-pc-windows-gnu, x86_64-pc-windows-gnu, + i686-unknown-linux-gnu, x86_64-unknown-linux-gnu, + x86_64-apple-darwin ] + exclude: # Do not build for macOS on Linux + - target: x86_64-apple-darwin + os: ubuntu-latest include: # List of all targets to build for and the name for common mortals - target: aarch64-unknown-linux-gnu name: arm64 @@ -97,9 +104,6 @@ jobs: os: macos-latest - - - # Runs on latest ubuntu by default except for windows targets runs-on: ${{ matrix.os }} @@ -122,11 +126,11 @@ jobs: args: --release --target ${{ matrix.target }} - name: Rename binary (Linux & macOS) - if: matrix.target != 'x86_64-pc-windows-gnu' + if: matrix.target != 'x86_64-pc-windows-gnu' && matrix.target != 'i686-pc-windows-gnu' run: mv target/${{ matrix.target }}/release/fbf target/${{ matrix.target }}/release/fbf-${{ matrix.name }} - name: Rename binary (Windows) - if: matrix.target == 'x86_64-pc-windows-gnu' + if: matrix.target == 'x86_64-pc-windows-gnu' || matrix.target == 'i686-pc-windows-gnu' run: mv target/${{ matrix.target }}/release/fbf.exe target/${{ matrix.target }}/release/fbf-${{ matrix.name }}.exe