Examples

This is a simple example of Proteus processing. Note that the ll file is provided so you may skip the production of this.

Produce the ll file

Below is a simple C++ program that uses a template function to print arrays of various types (src)
#include <iostream> #include <string> using namespace std; template< typename T > void printArray( const T *array, int count ) { for ( int i = 0; i < count; i++ ) cout << array[ i ] << " "; cout << endl; } int main() { const int aCount = 5; const int bCount = 7; const int cCount = 6; int a[ ] = { 1, 2, 3, 4, 5 }; double b[ ] = { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7 }; string c[ ] = {"HELLO","WORLD","How","are","you","?"}; printArray( a, aCount ); printArray( b, bCount ); printArray( c, cCount ); return 0; }
Using the below command line the ll file was generated
llvm-gcc template.cc -S --emit-llvm -o template.ll

Compile with Proteus

Now using this ll file generate an executable jar

java -jar Proteus.jar template.ll

Run the generated java executable

java -jar template.jar