Syntax Reference
Complete syntax specification for the Notations DSL
Basic Elements
Literals (Notes and Syllables)
Literals are text tokens without spaces. Any text can be used as a literal:
The notation system doesn't assign meaning to literals - only durations and layout matter.
Octaves
Dots indicate octaves. Place dots before a note for lower octaves, after for higher octaves (no spaces):
| Syntax | Octave |
|---|---|
...S | Three octaves below |
..S | Two octaves below |
.S | One octave below |
S | Middle octave (default) |
S. | One octave above |
S.. | Two octaves above |
S... | Three octaves above |
Whitespace
Spaces and line breaks between notes are ignored by the parser. They don't affect timing or layout:
Both lines produce identical output.
Spaces (Karvais)
Spaces represent empty durations where the previous note continues. Use commas:
| Symbol | Name | Duration |
|---|---|---|
, | Space (Karvai) | 1 unit |
; | Double space | 2 units |
_ | Silent space | 1 unit (not displayed) |
Silent spaces consume duration without displaying the space symbol, useful to avoid clutter.
Rests
Use hyphen for an explicit rest (no note continuation):
Groups
Square brackets group multiple notes into a single beat:
Groups can be nested:
Note Durations
Prefix a note with a number or fraction to set its duration:
Fractional durations are also supported:
Roles
Roles represent different types of content. Use a role selector with a colon (no space before colon):
Common roles:
- Sw - Swaras (notes)
- Sh - Sahitya (lyrics)
Create custom roles with the \role command.
Commands
Commands start with a backslash and control notation behavior:
\commandName(param1, param2, key=value)
See the Commands Reference for details.
Embellishments
Embellishments start with a tilde and continue until whitespace:
See the Embellishments Reference for details.
Comments
Use // for line comments:
// This is a comment
S R G M
// Comments are ignored by the parser
P D N S.
Block comments are also supported:
/* This is a
multi-line comment */
S R G M
Grammar Summary
notation := elements
elements := (command | roleSelector | atoms)*
command := "\\" name "(" params? ")"
roleSelector := name ":"
atoms := atom+
atom := duration? leaf marker?
leaf := literal | group | space | rest
literal := (dots? ident dots?) embellishment?
group := "[" atoms "]"
space := "," | ";" | "_"
rest := "-"
duration := number | fraction
fraction := number "/" number
octave := "."+ (before or after literal)
embellishment := "~" text
marker := "<<" text ">>" | ">>" text "<<"