-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcab6b6
commit ee1a795
Showing
6 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env bf | ||
[SPDX-FileCopyrightText: Brainfuck Enterprise Solutions | ||
SPDX-License-Identifier: WTFPL] | ||
[format.bf---Brainfuck code minifier. | ||
Removes all the non-command character from the input. The input | ||
should be valid Brainfuck code with balanced square brackets, | ||
followed by the exclamation sign. The output is minified code as one | ||
line without non-command characters | ||
Memory layout is: | ||
[case flag][char][char copy] | ||
Code starts here:] | ||
read char until EOF (-1) | ||
,+ | ||
[ restore the char | ||
- | ||
[>+>+<<-] duplicate the char | ||
+> set case flag | ||
[ plus (43) | ||
----- ----- ----- ----- | ||
----- ----- ----- ----- --- | ||
[ comma (44) | ||
- | ||
[ minus (45) | ||
- | ||
[ period (46) | ||
- | ||
[ less than (60) | ||
----- ----- ---- | ||
[ more than (62) | ||
-- | ||
[ opening bracket (91) | ||
----- ----- ----- ----- ----- ---- | ||
[ closing bracket (93) | ||
-- | ||
default: kill the char and case flag and copy | ||
[<->[-]>[-]<] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
command case: kill flag | ||
<[-]>] | ||
>[.[-]] print and kill the copy | ||
read a new char and subtract exclamation mark | ||
<<,+] | ||
++++++++++. |