From Esolang
Jump to: navigation, search

Todo list :

-Find a nice name for the language

-Find a way to use { }

If you want to help for any of these, or if you think you found an error in the specifications (that's hard to tell, without an interpreter), please contact me on this page. English is not my native language, so feel free to correct any spelling/grammar mistake without asking (sorry if there's too many of them). Grimy 23:08, 10 May 2010 (UTC)

I wrote an interpreter for it, it is here. Some of the examples don't work, but it seems to be the examples' fault (or I misunderstood the specification).
For example, the 'powers of N' program
seems to mean
?  input to acc 
^  add 1 to acc 
[  begin loop 
$  output acc 
*  acc = acc * current cell (which is 0 because the cells haven't been touched)
]  end loop
and indeed, my interpreter, given a number N outputs
 N+1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
when given this program.
seems a bit more logical and this indeed works. --Marinus 04:11, 20 May 2010 (UTC)
Thanks for the interpreter ^^. This example doesn't work because it's the first I wrote and I changed the meanings of some commands in the specs after writing it. It should be ?@<[$*], or +?~[$*] (in both cases, the infinite loop starts with input in the pointed cell and 1 in ACC, prints ACC, multiplies it by input...). The program ?[$@*] you suggest indeed doesn't work : when given 2, it outputs 2 4 16 256... instead of 1 2 4 8 16...Grimy 21:52, 21 May 2010 (UTC)
The quine didn't work : I fixed this. The prime numbers program doesn't work, but it may be the interpreter's fault : n2d1+:*n>(:$ ;:)d%(1@n+d) outputs 2, while n2d1[+:*n>(:$ ;:)d%(1@n+d)] output nothing. This is not logical, as the first iteration of the loop should work just as the version without loop. Right now I'm rather tired, but I'll doublecheck this as soon as possible. Grimy 22:41, 21 May 2010 (UTC)
The one with the loop doesn't output anything, because it generates a "2" (like the one without the loop) and then goes into an infinite loop. The 2 alone does not fill up the stdout buffer so nothing gets written to stdout. Adding "sys.stdout.flush()" after the line "sys.stdout.write(str(self.acc) + ' ')" in the interpreter makes it flush the buffer every time and then the 2 does show up. (The rest of the loop doesn't seem to output anything. --Marinus 11:36, 22 May 2010 (UTC)
My apologies, it was indeed the program's fault. It's hard (for me) to write an operational program on the first try, and without your interpreter I wouldn't have been able to detect the error. I updated the page with a new version of the "prime numbers" programs. Now all of my examples are okay under your interpreter.

Grimy 20:54, 22 May 2010 (UTC)

Error mode = context

The article says all commands are context insensitive, but if-clause and comments work by switching to "error mode". Strictly speaking, this is context influencing the way commands work. --Stop h time 22:16, 10 May 2010 (UTC)

I know. That is why the line stating that commands are context-insensitive also precise that errors may affect execution. As this language is also designed to be usable, this concession is essential. Implementing "if" statements while strictly not using context is hard : because "if" is executed before "endif", the program can't know where "endif" is (that would be context), so the only way to do it would be a command like "skip n instruction to the right", which is really not handy. Grimy 23:08, 10 May 2010 (UTC)