Wiki

Clone wiki

NetFuck / Home

NetFuck

The first interpreter for the language of the same name. For the language details, read its esolangs wiki page.

Summary

NetFuck is really just an extension to brainfuck (hence the tribute in the name). It adds a handful of operators on top of the traditional ones, those being:

  • ^ to send the value of the current cell into the socket.
  • v to receive a value from the socket into the current cell.
  • ~ to wait 10 × the current cell value number of milliseconds.
  • & to terminate the program.
  • * to emit a sound somehow affected by the value in the current cell.
  • | to separate code into two threads, who share the same tape (it can only appear once).

The following sample program emulates a teletype chat system, running the receive code in one thread and the send code in the other:

+[>v.<] | +[>>,^<<]

Run it in the interpreter, connecting to the host:port that another client is on to see it in action.

Current Version

  • The terminal for POSIX systems is modified during the running of the program, so getch() can be emulated (turning off line buffering on stdin). It is restored after.
  • Luckily valgrind was reporting "No leaks possible" on all prior commits. I still have yet to check for commit 8ce410d46de2.

Usage

nf [[-h hostname] -p port] file

If hostname is omitted, "localhost" is used. If a connection cannot be established, the program enters server mode, waiting for an incoming connection itself, and then executes with that socket connection.

Updated