Closed xavriley closed 8 years ago
The context is (IMHO) part of the interpretation phase and not part of the parsing phase. A 'd' is a 'd', regardless of octave. During interpretation (I'll talk about when that is) you would have context around and assign the correct octave to the symbol 'd'.
Interpretation phase can be either during the transformation of the AST resulting from your parse or (and I prefer this) even later on. Transform your AST into a structure that you can work with. Then perform transcription and other work on that (called compiler passes in compiler construction).
Am I missing something? Does that make sense?
regards, k
inactive.
Hi,
I've been thinking about how to go about parsing various music scripting languages and this one has me a bit stumped:
Input:
Output:
In this script there is an implicit context of "what is the current octave?" which is what makes the first
d
appear in a low octave and, as the music moves by small steps, the secondd
appear in an upper octave.I'm trying to work out how to approach this using Parslet but I couldn't find any examples. I have a hunch that it will be something to do with tracking a context as it moves through a parse but I'm not sure. I'm new to parsing in general.
The reason I've opened it as an issue is partly because I didn't get an opt in response from the librelist bot (although I might just be being impatient...) Also I hoped it might be an interesting potential example.
Also, Parslet is amazing and I'm really sorry in advance if filing this as an issue bothers anyone. Thanks!