Compiling Music for reals

Now let's actually write the compiler. You can assume you have a working endTime function from the last exercise.

To get your mind working here is an example MUS program:

And here's what it should compile to in NOTE:

Write a function compile that compiles MUS songs into NOTE songs.

You will need your solution later, copy it down somewhere for reference.

1:1

In my solution I used a helper function named compileT that takes a MUS expression expr and a time t. Assuming the notes start at time t, it returns the NOTE program that corresponds to expr.

Once you have compileT working then the compile function is easy.



Prev Next