Replies: 10 comments
-
This might be better suited for the subreddit or the slack group. I don't know if there's a formal grammar, but you can learn more about current syntax from the docs. Edit: also inline clojure is not being supported in the future, so it might not be worth it to add... |
Beta Was this translation helpful? Give feedback.
-
Echoing what I said on Slack: I'd be very surprised if anyone had an updated BNF grammar for Alda. If there is, I'd love to see it, make corrections and make it part of the Alda repo to sort of "standardize" it. I think having a language spec would be a very good thing, for example to support use cases like yours where you want to add editor support, and you want to base your work on a canonical source of truth. I'd be happy to do what I can to push us further in that direction, although my time is limited (especially with my current focus on getting Alda 2 released!), so I probably won't be able to find time to write an updated BNF grammar myself for a while. Alda 2 will be released soon, and it's worth noting that from a language perspective, Alda 2 is almost identical to Alda 1. The one breaking change is that inline Clojure code is no longer a part of the language. As luck would have it, over the weekend, I wrote up an Alda 2 migration guide, where I discussed in detail what changed. Syntactically, the only difference is that the Lisp expressions aren't Clojure anymore; now it's very simple, bespoke Lisp. For example, Alda 1 (Clojure) |
Beta Was this translation helpful? Give feedback.
-
Hi. I am working on javascript DAW called Cyber Music Studio. I am thinking about adding subset/superset of Alda to it as sequencer tool. I am not sure how to implement it, I have two different ideas: a) just support some subset of language and throw some regexes to parse it I think the latter would be useful for wider Alda community (we can implement Alda in browser now!) but it will be more work. Also - I am not sure how old BNF reflects current status of Alda and what rules for whitespaces Alda follows. Latter is especially confusing. |
Beta Was this translation helpful? Give feedback.
-
I'd say that old BNF is probably a reasonable starting point. It probably needs to be updated in various ways. Maybe a good smoke test would be to try implementing a parser (using Peggy or whatever) with that BNF grammar, and then parse these example scores and let the parse errors guide you to the places in the grammar that need to be updated. |
Beta Was this translation helpful? Give feedback.
-
This is an amazing idea, BTW! I'd love to be able to input notes in a DAW via Alda instead of a piano roll, etc. |
Beta Was this translation helpful? Give feedback.
-
I started working on Alda reimplementation in javascript here.
It can be IMHO done now - either via importing MIDI fire from |
Beta Was this translation helpful? Give feedback.
-
After some time I did some improvements on my parser and I ran into some things I cannot parse and I have no idea what these are:
Also I am not sure where is whitespace optinal and where is mandatory. Also it seems that newlines does not have semantical values unless you are parsing variable definition. |
Beta Was this translation helpful? Give feedback.
-
Here is some information about accidental syntax ( This blog post I wrote is also a good introduction to pitch, accidentals and key signatures.
Cram expressions are documented here. I hope this helps! Let me know if you have any further questions. Maybe Slack would be a better place, so that we can keep this issue on topic. |
Beta Was this translation helpful? Give feedback.
-
In general, whitespace is not significant in Alda. The one exception is that a newline can end a variable definition. One line variable definition:
Multi-line definition:
A variable definition becomes multi-line if you start an event sequence or cram expression and don't end it before the end of the line. Unless I'm forgetting something, I think that's the only case where newlines are significant. |
Beta Was this translation helpful? Give feedback.
-
A formal alda language specification / definition in BNF would be a good thing. While revisiting the BNF definition, maybe it is a better idea to refer to The Structure of MusicXML Files so as to make the future translation more smoother/easier. |
Beta Was this translation helpful? Give feedback.
-
Hi, I hope I'm posting this in the right place. In brief, I'd like to create support for alda in a new editor. However, I can't find any overarching specification for the language.
The best thing I have is this old file: https://github.com/alda-lang/alda-cljs/blob/master/grammar/alda.bnf, but I believe that alda syntax has changed quite a bit since then (isn't there no support for multi-line comments, for example?)
As I'm really worried I'll miss small (but important) elements of alda's syntax, the best I can do is copy existing alda plugins for other editors. Not only is this cargo-culting, but what I'd really like to do instead is write some very robust syntax highlighting, with inlined Clojure, the works!
Thanks if you can help, and I look forward to contributing to the alda community!
Beta Was this translation helpful? Give feedback.
All reactions