Talk:Smurf
From Esolang
Contents |
[edit] Has Smurf been proved Turing-complete?
Smurf is described on the Muriel page as an attempt to make a Turing tarpit from that language. Has a proof of Smurf's Turing-completeness actually been constructed? If not, I might work on it myself, as Smurf is a rather elegant language. --Safalra 18:31, 21 Oct 2005 (GMT)
- Elegant indeed. Like the Lambdae, but with strings instead. --Ihope127 18:44, 21 Oct 2005 (GMT)
[edit] Year
In what year was this language created? --213.119.115.231 20:20, 21 Oct 2005 (GMT)
- 2001.. you can search for the announcement in this archive: http://esoteric.sange.fi/archive/2001-q2-1 Calamari 08:45, 19 Nov 2005 (GMT)
[edit] Smurf instruction minimalisation
If we limit the contents of Smurf strings to the same characters as the other instructions (which should have no effect on Turing-completeness) then it has three states (call them READING_INSTRUCTION, READING_STRING and READING_ESCAPED_CHARACTER) and 11 symbols ("\+pgiohtqx). This symbol set can be reduced further (without resorting to using multiple symbols to encode single instructions), although it may seriously reduce the elegance of the language:
- Remove x, i and o - initialise the stack with the input (or the empty string if there is no input), and at the end of the program pop the string at the top of the stack (if there is one) and output it, and then pop another string from the top of the stack (if there is one) and execute it
- Remove + and g, and create a new j command - pops two variable names from the top of the stack and joins their values, so + becomes "first"p"second"p"first""second"j and g becomes ""j (assuming the variable "" is unset)
- Remove h and t, and create a new s command - splits a string into a head and a tail and pushes them onto the stack (tail first), so h becomes s"head"p"tail"p"""head"j and t becomes s"head"p
The reduces us to "\pjsq
The previous 'improvements' aren't too bad, but the one that follows is an ugly mess:
Also it might be possible to remove one state by changing the behaviour of " - instead of marking the beginning of a string, it marks one character to add to some 'string buffer', and the string is written when a character other than " is read (which is then ignored). This, though, is really inelegant, because of the use of a dummy instruction. If this paragraph wasn't clear, it means that something like:
"key""value"p
...becomes:
"k"e"y?"v"a"l"u"e?p
...where ? should be replaced by and symbol other than the quotation mark. Note that this removes the need for any escaped characters (and hence escape state), as something like:
"\\\""
...becomes:
"\""?
Note that there's no method for having newlines in a string now (as we can't add them into the source without introducing an extra symbol), but this doesn't affect Turing-completeness. Furthermore, constructing an empty string involves construction of a one-character string and then taking its tail - extremely inelegant. Obviously the behaviour of the q command would now change.
--Safalra 14:47, 22 Oct 2005 (GMT)
[edit] Quine
Something interesting... with the online interpreter, I managed to make this quine:
"qoto"qoto"I was just talking and someone interrupted Or was it a loud explosion?
Needless to say, it's rather abusive of the language. Its function, however, should be independent of the actual error message. (as long as there are no quotes in the error)
A worse abuse is:
It's hard to understand me from the language I use There's no word in English for my style
Trivial perhaps, but I found them amusing. :P
-- Nonny
- The empty string is also a quine. --Ihope127 15:39, 3 Dec 2005 (GMT)

