bugSophia

From Esolang
Jump to: navigation, search

bugSophia (bS for short) is a massively concurrent programming language. The language represents data as bytes being carried by bugs through a 2D field of paths. Each bug can carry only one byte. When a bug reaches an intersection it creates concurrently running copies of itself that travel down each possible path. Unary operations occur when bugs travel over commands. Binary (and higher-ary) operations occur when multiple bugs travel over commands at the same time.

The language uses FIFO "streams" to store and communicate large numbers of bytes. A stream is represented by a Unicode character. The ' . and , commands (write, wait-until-read, and read, respectively) operate on streams adjacent to them. The stan rune (ᛥ) in particular represents standard io.

Example programs

(Note: Parts of these examples are in Unicode, so they may vomit out little blocks (or question marks) if you don't have the right font.)

Hello, World!

 "+-+-+-+-+-+-+-+-+-+-+-+-+
  ` ` ` ` ` ` ` ` ` ` ` ` `
  H e l l o ,   W o r l d !
ᛥ'<-<-<-<-<-<-<-<-<-<-<-<-<

Cat

   "v-<
    .ᛥ'
    >-^

Truncated 99 bottles



             ">v                     
              |<
              +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` |
                b o t t l e s   o f   b e e r   o n   t h e   w a l l . |
           ᜀ'<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<

                         >-v
                         | |       <---counter
                       ᜁ' (
                         ^-<-c`-"    


                                    >-v
                                  ᜀ. ?
                                    ^-+
                                    | |
           @                        #ᛥ'
   "  ᜁ   |                         |           
   >--.---~g------------------------|
   |       ~       main loop        |           
   |       +v-"                     |           
   |       ^<                       |
   ^--------------------------------<