Team LiB   Previous Section   Next Section

7.1 Getting Started

The first step to working with IMCC is to compile it. First, build Parrot following the steps in the previous chapter. Then, from within the languages/imcc directory in the parrot repository, type:

$ make

$ make test

It's likely that by the time you read this, you won't have to compile IMCC at all. One of the planned tasks is to include these steps in Parrot's Makefile, so it will be done when you compile Parrot.

After compiling IMCC, create a file fjords.pasm in the languages/imcc directory with these two lines (or reuse the file from Chapter 6):

print "He's pining for the fjords.\n"


IMCC compiles and runs the code in a single step:

$ ./imcc fjords.pasm

It's a little more convenient than the separate assembler and interpreter we introduced in the last chapter.

If your system supports soft links, you might find it handy to have a symlink to imcc in Parrot's root directory, or a directory in your PATH. You can try out all the examples in this chapter by copying the code into a test file with the .imc extension. If imcc is in your path, run the examples as:

$ imcc example.imc

or with the -t option to trace the code as it executes:

$ imcc -t example.imc
    Team LiB   Previous Section   Next Section