Skip to content

Instantly share code, notes, and snippets.

@fennecdjay
Last active November 27, 2017 04:50
Show Gist options
  • Save fennecdjay/ce7446e7c2c403a352ae86ea9e40805f to your computer and use it in GitHub Desktop.
Save fennecdjay/ce7446e7c2c403a352ae86ea9e40805f to your computer and use it in GitHub Desktop.

Overview

Gwion is a musical programming language, similar to chuck.
It also provides high-level features, like templating and function pointers.
The main difference being an emphasis on performance.
This page is just a quick overview of the language.

Comments

Since block bock comments are a bad idea, only lines comments are enabled.

// this is a one line comment
int i; // this comment comments a int declaration

Debug print

Gwion provides a debug print syntax, quite similar to the one in chuck.

int i; // declare an int veriable named i;
<<<i>>>; // print i's type, then i's value

// debug print can handle multiple variables
int i, j:
<<<i, j>>>; // prints i's type, i's value, then j'type, j's value

Note that it will first print the type of the value if there is only one value.

11 => int i;
// so do this to print '11'
<<<i, "">>>;

Reserved words

  • Primitives

    • int
    • float
    • time
    • dur
    • void
    • vec3
    • vec4
  • Control Structures

    • if/else
    • while/until/do
    • for
    • repeat
    • break/continue
    • return
    • switch
  • Other keywords

    • class
    • extends
    • public
    • private
    • static
    • fun/function
    • typedef
    • typeof
    • template
    • enum
    • union
    • const
    • spork
  • Special values

    • this
    • me
    • now
    • true/false/maybe
    • null/NULL
    • pi
  • Builtin durations

    • samp
    • ms
    • second
    • minute
    • hour
    • day
    • week
  • Builtin UGens

    • dac
    • adc
    • blackhole
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment