Q Language
sugarfi (473)


This is the beta version of the Q language.

What is Q?

Q is a functional-ish esoteric-ish language. It is based around the concept of
streams/queues, hence the name. There are four main types in Q:

  • A blob, which is just a bunch of raw numbers.
  • A queue, which is just a list of any of the other types.
  • A promise, which is a command to push a blob to a queue.
  • A handler, which is a command to execute a certain promise whenever a certain queue changes.


Blobs are just raw blobs of numbers. To declare a blob, use the syntax:

[1 2 3]

The brackets are mandatory.


A queue is just a list of any of the other data types. All programs are simply queues. To
"execute" a queue, the interpreter simply pops items off of it. If the item popped is a promise,
it is resolved. Otherwise, it is pushed again. This keeps going until the queue is empty.


A promise is like a JS promise: the interpreter "promises" to execute a bit of code, but gives
you no guarantee when (so maybe it's not exactly like a JS promise, whatever). To declare a
promise, use the format:

(queue <- [1 2 3])

A promise currently must be made up of a queue name followed by a <- followed by a blob.
All programs are simply sequences of promises and handlers. If the queue referenced by a promise
does not exist, it is created.


Handlers are not really a type - they are declared before runtime. A handler simply sets up
an event handler of sorts, which will trigger whenever a certain queue is pushed to. To
declare a handler, use the syntax:

(queue -> (queue2 <- [1 2 3]))

A handler must be made up of a queue name followed by a -> followed by a promise. Since handlers
are set up before runtime, they can be declared anywhere in the program, even before their
queue is pushed to.


Q is far from finished, and I plan to add quite a few features, including:

  • An stdlib
  • The ability to push promises to a queue
  • Syntatic sugar for strings and numbers
  • More flexible handlers

License and Credits

This code is licensed under GNU GPL v3.0. It was all written by me, sugarfi.

You are viewing a single comment. View All
theangryepicbanana (1530)

Looks good!
As a side note, you could remove a lot of boilerplate by changing stuff like

class Node
    @name : String
    @arrow : String
    @blob : String | Node
    def initialize(name : String, arrow : String, blob : String | Node)
        @name = name
        @arrow = arrow
        @blob = blob
    def name
    def arrow
    def blob


class Node
    property name : String
    property arrow : String
    property blob : String | Node
    def initialize(@name, @arrow, @blob)

by using builtins and stuff :)

theangryepicbanana (1530)

Additionally, you can use modules instead of classes with static properies/methods

sugarfi (473)

@theangryepicbanana i tried using modules, and it didn't work. also, thanks for the tip, i wasn't able to find something like that for crystal!

sugarfi (473)

@theangryepicbanana AlSo pLeAsE UpVoTe i nEeD MoRe cYcLeS

theangryepicbanana (1530)

@sugarfi Re: upvote, nO bEGgInG fOr CyClEs