\\\
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Paradigm(s) | String-rewriting paradigm |
---|---|
Designed by | .yazic |
Appeared in | 2023 |
Computational class | TODO: categorise |
Major implementations | TODO: implement |
Influenced by | ///, Thue |
File extension(s) | .bs |
\\\ or Backslashes, is a minimalist esoteric programming language created by User:.yazic in 2023, and was inspired by /// and Thue.
Description
First the text is parsed for replacement rules \foo\bar\
where foo
is the pattern to be replaced and bar
is the replacement pattern, then a random available replacement rule is selected and all instances of foo
after the rule are replaced by bar
. This is repeated until there is no rule that can replace anything and so the program halts and prints out any text thats left.
- replacement
Code:
\ab\c\ ab ab
Output:c c
- attempt to replace nothing will print the replacement out and pick a new rule
Code:
\\!\
Output:!
Everything inbetween two vertical lines |
is treated as a |comment|
and is ignored.
The forward slash /
is a special character that allows for multiple pattern replacements
- like this
Code:
\a/b\c\ a.b adb
Output:c.c cdc
- or like this
Code:
\a/b\c/d\ a.b afb
Output:c.d cfd
- or like this
Code:
\a/b/a\c\ a.b a.b
Output:c.c c.b
- the patterns have to be in order
Code:
\a/b\c\ a.b b.a
Output:c.c b.a
- the patterns have to be in order
- if there is more to replace than replacements then it cycles through the replacements
- like this
Code:
\a/b/c\d/e\ a.b.c a.b.c
Output:d.e.d e.d.e
- like this
- if there is more replacements than to replace then it adds excess replacements to the initial ones
- like this
Code:
\a\b/c/d\ a a
Output:bcd bcd
- or like this
Code:
\a/b\c/d/e\ a.b a.b
Output:ce.de ce.de
- or like this
Code:
\a/b\c/d/e/f\ a.b a.b
Output:ce.df ce.df
- like this
- which allows for this
Code:
\a/b/c\d/e/f/g/h\ a.b.c a.b.c
Output:dg.eh.fg dh.eg.fh
It also esapes other special characters.
- like this
Code:
/|Hello,world!|Goodbye,World!
Output:|Hello,world!
- and it still works for multiple pattern replacements
Code:
\a/\\b//\ a\\c\
Output:b/c
- note that this may also output
c b/c
- note that this may also output
Examples
Hello, World!
Hello, World!
Truth machine
On 0 outputs 0 and halts, on 1 outputs 1 indefinetly.
Put 0
or 1
instead of ?
.
\/.0\0/ \|if 0 halt and output "0 " |\/.1\1/.,\|if 1 output "1" and replace "1" with "," |\,\1\|replace "," with "1" |.?
Shakespeare outputter
Given enough time this may output a copy of a Shakespeare play.
\/..\ /.,\| |\/..\a/.,\| |\/..\b/.,\| |\/..\c/.,\| |\/..\d/.,\| |\/..\e/.,\| |\/..\f/.,\| |\/..\g/.,\| |\/..\h/.,\| |\/..\i/.,\| |\/..\j/.,\| |\/..\k/.,\| |\/..\l/.,\| |\/..\m/.,\| |\/..\n/.,\| |\/..\o/.,\| |\/..\p/.,\| |\/..\q/.,\| |\/..\r/.,\| |\/..\s/.,\| |\/..\t/.,\| |\/..\u/.,\| |\/..\v/.,\| |\/..\w/.,\| |\/..\x/.,\| |\/..\y/.,\| |\/..\z/.,\| |\/..\ /.,\| |\,\.\| |..
Add more examples.
Interpreters
Add more interpreters.