The DBToaster compiler is used to generate incremental maintenance (M3) programs. M3 programs can be executed in the following ways:
- Standalone Binaries: The DBToaster compiler can produce standalone binaries that evaluate the M3 program. This requires invoking a second stage compiler (g++ or scalac) to generate the final binary.
- Source Code: The DBToaster compiler can also produce source code that can be linked into your own binary.
1. Requirements
Several dependencies are needed to run DBToaster.1.1. Windows
We tested DBToaster successfully on:- Oracle JDK 7 (or above)
- Cygwin
- gcc-g++ 4.8 (or above)
- Scala 2.10.2
1.2. OS X
- Oracle JDK 7 (or above)
- gcc-g++ 4.8 (or above)
- Scala 2.10.2
For installing gcc (if you are using Homebrew), the following commands can be used:
In order to tell DBToaster to use a custom C++ compiler, create a symlink gpp in the DBToaster directory that points to the compiler:
DBToaster detects that this link exists and uses it instead of g++.
1.3. Linux
The easiest way to use DBToaster on Linux is to install the following dependencies with the package manager of your choice:
- Oracle JDK 7 (or above)
- gcc-g++ 4.8 (or above)
- Scala 2.10.2
Note: Other versions of the tools/packages might work as well but have not been tested.
2. Evaluating a simple query
DBToaster provides the -r flag which generates, compiles and evaluates a query in one simple step. This is a convenient way to check whether DBToaster and its dependencies have successfully been installed.The following command evaluates the rst query that ships with DBToaster:
3. Generating Standalone Binaries
To use DBToaster to create a standalone binary, invoke it with -c [binary name]. The binary can be invoked directly. It will print the results of all queries once all data has been processed.
The following command line will generate the rst executable:
Running the rst executable will produce the following output:
To produce a scala jar file, invoke dbtoaster with -l scala, and the -c [binary name] flag as above. DBToaster will produce [binary name].jar, which can be run as a normal scala program. For more details, please refer to Scala Code Generation
4. Generating Source Code
DBToaster's primary role is the construction of code that can be linked in to existing applications. To generate a source file in C++ or Scala, invoke it with -l [language], replacing [language] with cpp or scala. If the optional -o flag is used to direct the generated code into a particular file, the target language will be auto-detected from the file suffix (".scala" for Scala, and ".h", ".hpp", or ".cpp" for C++).