Sceql

From Esolang
Jump to: navigation, search

Sceql is an esoteric programming language devised by Scott Feeney in 2005, which provides a single byte queue as the only form of memory available to programs. The queue can never be empty, and data can never be removed from it once enqueued into it. Initially the queue has one value of 0.

Sceql was originally intended as a revised version of Qdeql with an easier to use and more practical instruction set, but with the additional challenge of a queue that grows indefinitely and never shrinks.

Instructions[edit]

Instruction Description
= NEXT Dequeue a byte and enqueue it again
- DEC Decrement the byte that would be dequeued next (wrapping)
_ INC Increment the byte that would be dequeued next (wrapping)
\ BEGIN Skip to the instruction after the corresponding END if the byte that would be dequeued next is zero
/ END Go back to the corresponding BEGIN
! GROW Enqueue a new zero byte
& INPUT Read a byte from stdin and enqueue it (0 for EOF)
* OUTPUT Dequeue a byte, write it to stdout, and enqueue it again

Example programs[edit]

Hello, World![edit]

This program will print the string "Hello, World!" followed by a newline. Every line of the program corresponds to one character; the queue eventually will contain three bytes, one used for H, e, l, o, W, r and d, one for the comma, space and exclamation mark, and one for the newline.

________________________________________________________________________*
_____________________________*
_______*
*
___*
!=____________________________________________*
=------------*
________*
=--------*
=___*
=------*
=--------*
_*
!==__________*

Cat program[edit]

-&=\&*_\-=_/-=/

In clear text, with the state of the queue in comments (assuming everything which is not an instruction is ignored):

[0]
DEC INPUT NEXT
[first 255]
BEGIN while not eof
  [prev ... 255]
  INPUT
  OUTPUT
  [... 255 curr prev]
  INC BEGIN while not 255
    DEC NEXT INC
  END DEC
  NEXT
  [curr ... 255]
END

Computational class[edit]

Sceql is Turing-complete. See Sceql Turing-completeness proof for more information.

See also[edit]

External resources[edit]