"You realize everyone is going to think you are insane?" - miggles
Skoar is a musical notation language.
Skoarcery is the compiler compiler that compiles skoar lexers and parsers for SuperCollider and Python.
This is alpha software. Most of the things described here are implemented. The python implementation needs alot of work to bring it to where the SuperCollider one is.
Focus is on SuperCollider at the moment.
Skoar is a mini language for describing music, it is compiled into a parse tree that can be traversed, implementing a SuperCollider pattern.
("""
||: Am ]]] oo/ ]]] | G oo/ ]]] ooo/ | F oo/ ]]] ooo/ | F ooo/ ]]] oo/ :||
""".pskoar.play;
)
))) - whole noat
)) - half noat
) - quarter noat
] - eighth noat
]] - sixteenth noat
]]] - thirty second noat
}}} - whole rest
}} - half rest
} - quarter rest
o/ - eighth rest
oo/ - sixteenth rest
ooo/ - thirty second rest
). - dotted quarter
]]. - dotted sixteenth
o/. - dotted eighth rest
<? you can use # or b after the noat to sharp or flat it. Also midi numbers. ?>
|| c ) d ) eb ) | f ]] ]] g ] ] g# ) | } 81.5 ) 83 ) ||
<? you get two octaves to work with, prepend _ for the lower octave ?>
||: d ) _a ) a ) _a ) :||
Choards need work, but this is the intention:
A Am A#m Asus2 Adim etc..
Or use lists of noats:
| <a,c,e> ) <81, c#, e> ) |
<? up one octave ?>
~o
8va
ottava alta
<? up two ?>
~~o
15ma
alla quindicesima
<? down one ?>
o~
8vb
ottava bassa
<? down two ?>
o~~
15mb
Have to use the full word forte
, f
is a noat.
fff ffforte ppp pppiano piano mp mf ff pp p
Colons
|: _a ]]] c ]]] e ]]] :|: g ]]] ooo/ ]]] :|
Segnos %S%
and Codas (+)
:
| _a ) c ) e ) | %S% ) ]] ]] e ]] | f D.S. al fine ) ) ) fine
Infinite repeats:
<? from the top ?>
| _a] c] e] | D.C. <? also accept Da Capo ?>
<? from the segno ?>
| _a] c] e] o/ | %S% _f] f] _f] o/ Dal Segno |
We use SuperCollider Symbols, but with a @
instead of a \
, and use a dictionary.
@smooth => @instrument
<0,3,5> => @detune
|: a ) c ) e ) :|
You can wake cthulhu, crashing the skoar..
<? crashes ?>
| a ) ^^(;,;)^^ |
<? ensure Dal Segno is working ?>
|: a ]] ]] Dal Segno ^^(;,;)^^ %S% ) ) :|
Cthulhu can assert stuff too, you have to stick it right in his face, he's sleeping.
^^(;@octave == 5;)^^
Or save him to wake later with any message.
^^(;,;)^^ => @foo
@foo.anything
map Klass folder to the SuperCollider extensions folder.
ln -s ~/.../Skoar/SuperCollider/Klassy ~/Library/Application\ Support/SuperCollider/Extensions/Klassy
The lexical and syntactic analysers, lex.sc and rdpp.sc (ditto .py) are built with Skoarcery. They are built and written to SuperCollider/Klassy.
Currently the built code is checked in, so it should work after mapping the folder (and restarting SuperCollider).
-
Tokens by convention are UpperCamelCase.
-
Tokens are defined with regexes that have to work with both SuperCollider and Python. All we do is recognise, no capture groups.
- If tagged with *, it means see appropriate toke_inspector for further token processing.
- SuperCollider: toke_inspector.sc
- Python: toke_inspector.py
- If tagged with *, it means see appropriate toke_inspector for further token processing.
-
Defines an LL(1) grammar suitable for building recursive decent parsers for skoar.
-
Nonterminals by convention are like_this
-
+ before a nonterminal indicates this is an intermediate step that can be skipped in the constructed parse tree, it will not create a new skoarnode, instead appending its noads to its parent's children list.
-
* after a nonterminal means there is corresponding semantic code for this, defined in:
- SuperCollider: skoarmantics.sc
- Python: skoarmantics.py
- langoids.py - Terminal, Nonterminal, Production objects,
- dragonsets.py - FIRST and FOLLOW sets, from the Dragon Book.
- emissions.py - Implements Python and SuperCollider coding.
- underskoar.py - Templates for lexer code
- These are our unit tests.
- Test the grammar for LL(1), test that it compiles in sclang, test skoars, etc..
-
These are written as unit tests, they build our lexers and parsers. Done this way because we generate some information, test it, build on it, test that ...
-
The important one at the moment is Build_Sc.py, it will run tests, build files, run more tests, etc.. it builds Skoar. This one builds Skoar.
-
Code_Lexer_Py.py, Code_Lexer_Sc.py - Build lex.py, lex.sc
-
Code_Parser_Py.py, Code_Parser_Sc.py - Build rdpp.py, rdpp.sc
-
lex.sc - Lexical analyser, defines classes for each token, extending SkoarToke.
- in Skoar, we call them Tokes, in Skoarcery, they are Terminals, or tokens.
-
rdpp.sc - Recursive decsent predictive parser. Builds the parse tree.
- apparatus.sc - Stuff to do with the parse tree, and iterators of it. Lots in here.
- toker.sc - The guy the parser deals with when it wants tokes.
I use PyCharm. The "builds" are done throught the unittest interface.
PyCharm also works with the SC textmate bundle.
It is entirely too early to be performance tuning Skoar, but some notes:
- We don't currently have precompiled regexes in SuperCollider.