Created
August 16, 2024 05:58
-
-
Save guaracy/d0a370aee437bb77c0c5910090a26ddd to your computer and use it in GitHub Desktop.
BF em 23 linhas (legível)
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
Red [] | |
bf: function [prog][ | |
size: 30000 | |
cells: make string! size | |
append/dup cells null size | |
parse prog [ | |
some [ | |
">" (cells: next cells) | |
| "<" (cells: back cells) | |
| "+" (cells/1: cells/1 + 1) | |
| "-" (cells/1: cells/1 - 1) | |
| "." (prin cells/1) | |
| "," (cells/1: first input "") | |
| "[" [if (cells/1 = null) thru "]" | none] | |
| "]" [ | |
pos: if (cells/1 <> null) | |
(pos: find/reverse pos #"[") :pos | |
| none | |
] | |
| skip | |
] | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment