::SHE+ILA:: code blocks [$01]

Classroom with Whiteboard and Colorful Number Blocks
55
0
  • Squishy Plushie's avatar Artist
    Squishy Pl...
  • Prompt
    Read prompt
  • DDG Model
    ArtFusion
  • Access
    Public
  • Created
    3mos ago
  • Try

More about ::SHE+ILA:: code blocks [$01]

One of a series on the operating system / programming language ::SHE+ILA::, this description covers vectors, procedures, multithreading, events, and loops.
Vectors are one-dimensional arrays or buffers, and are coded using round brackets thus : (woo, yay, squee). Their datastore representation uses opcodes B0 ... B9.
Embedded comments use the opcode F0, and start with a double slash // . They end with the very next semicolon (unlike C++ where they continue to the end of line). This allows statements to occur after comments on the same line. Note that /* and */ are NOT valid comment delimiters, because */ represents "multiply reduce" (see ::SHE+ILA:: opcodes).
Procedures are functions and lambdas, and use curly braces : {woo; yay; squee}, and use opcode F1. Their returned result is the result of the final expression in the braces.
Concurrency is coded by a multithreaded procedure, coded using "bang braces" : {! woo; yay; squee !}, which exits when all the threads have completed. It uses opcode F2.
Event blocks use "query braces" and exit when any one of the enclosed events occurs (such as arithmetic exceptions or sense switch inputs) : {? woo; yay; squee ?}. Guards (conditions) may be prefixed to each event, for example {? x.eq.0 : woo; i.gt.100 : yay; squee ?}; It has the opcode F3. Their result is the (origin 1) index of the event that triggered, for example if "squee" occured in the above example, the code block would return 3.
And finally, loops use "star braces", for example : {* i++ . ttyout *} which would loop forever printing successive integers. It has the opcode F4.

Comments


Loading Dream Comments...

Discover more dreams from this artist