Aratu music written to play, and to change while it plays

2. The lexicon: the words of the language

▶ Open in Aratu to hear and change the examples

The lexicon is the set of words, or tokens, Aratu recognises. Each line is a statement. Inside braces, ; separates statements on one line, and // starts a comment to the end of the line.

Kind Examples What it is
name (identifier) melody, bass, riff, temas letters, digits and _, starting with a letter
path bass.reverb.mix, drums.hh, riff.inv names joined by dots
keyword tempo, meter, key, pattern, play, at, every, now, over, motif, row, list, from reserved words, with a fixed meaning, in English, Portuguese or Spanish (tempo, andamento, pulso)
number 120, 0.42, -1, 1.2 whole numbers and decimals, with a point
unit Hz, kHz, ms, s, % right after a number
operator =, :, ->, <->, ., , join the parts of a statement
music c4, f#, eb, do4, Am, c, o, _, -, [ ], { | }, | the symbols inside a line of music

The music symbols make a small language inside the language: a music literal, the way a string or a number is a literal in other languages. A space separates beats, | separates bars, [ ] groups within a beat, { | } draws one, _ holds, - rests, + joins notes in a chord, upper case accents, ' is staccato, ^ is a fermata, ? is chance and x4 repeats.