Compiling

The Rapture Programming Language is an imperative, compiled, interpreted language.  This means that the language is procedural (as opposed to object-oriented) and compiled into a binary representation that allows execution on a virtual machine (as defined by the virtual machine’s architecture).  All this is really just being technical.  In layman’s terms, it means you program in this language (without using any of those fluffy classes and objects and whatnot), compile it, and then run the resulting ‘executable’ by having the Rapture Runtime Environment load and execute it.  What is discussed here is how to generate an executable from source file(s), and how to execute it once it has been created.

Summary
The Rapture Programming Language is an imperative, compiled, interpreted language.
A few types of files are used throughout the compilation process, all of which are distinguished by the ‘extension’ on the end of the filename.
So, you can see the overall process, but want to know how to actually go about compiling something? 

File Extension Types

A few types of files are used throughout the compilation process, all of which are distinguished by the ‘extension’ on the end of the filename.

.rA Rapture language source file.
.rhA Rapture language source header file.
.rmsgA Rapture language message file.
.rasm(Internal) A Rapture ‘assembly’ file.
.oA Rapture binary linkable ‘object’ file.
.rx(Optional) A compiled Rapture executable.

The extensions marked (Internal) are indeed just what they say, internal to Rapture and not really needed by normal users.  The compilation process can be visualized as follows:

+-------------+                 +-------------+
| Source File |---- Compile --->| Object File |--+
+-------------+ +-------------+ |
+-------------+ +-------------+ | +------------+
| Source File |---- Compile --->| Object File |--+-- Link -->| Executable |
+-------------+ +-------------+ | +------------+
|
... ... ... |
|
+-------------+ +-------------+ |
| Source File |---- Compile --->| Object File |--+
+-------------+ +-------------+

As you can see, you take source files (in .r files) and compile them using the Rapture compiler to generate binary linkable object files (or .o files).  Once you have one or more of the .o files, you can link them into an executable (you had better have a main() subroutine!) that is capable of being run.

Compilation Example

So, you can see the overall process, but want to know how to actually go about compiling something?  Well, let’s say you had the source files foo.r, bar.r, and baz.rh, and you’re trying to compile them together to make a single executable game.rx.  You’d do the following steps:

Compile the source files

$ rc -c foo.r -o foo.o
$ rc -c bar.r -o bar.o

Link the object files into the executable

$ rc -o game.rx foo.o bar.o

Once you’ve got the executable (with no errors), you can run it

$ rapture --Executable game.rx

For more information on running and configuration options, see Configuration.

Most of the behavior of Rapture can be customized through command line options or (preferably) through a specified configuration file.