MUS Compiler in Node.js

Now take your answers from the previous exercises in this lesson and put them together in one file to define a MUS compiler. I created a mus/ directory in my GitHub repository, then put a file called compiler.js in the directory. The file contained my definitions for endTime, compileT, and compile.

To try the compiler, I ran node compiler.js. Once you fix any syntax errors, it should do nothing. Not too exciting.

Next I added some tests to the end of my code. I added:

The console.log function shows values of variables to the screen. The code above shows the value of a test song, then what it compiles to so you can see if it looks right.

We'll cover much better ways of testing our code in the next lesson. For now this should be enough to allow you to make progress.

Get your MUS compiler working in a file in your local project directory.

Prev Next