Examples for Grapnel Compiler

Examples of GRP language

Test applications for Grapnel compiler

Every applications need pvm3 and grapnel library.

Example of three processes

Source files of test program generated by grp2c

Overwiev of application

Application t2 contains three processes. The first process (t2p2) sends data to each other. It sends a double type data to t2p3 with value 1.1. After that it modifies data value to 2.2 and sends it to t2p3. The second process (t2p3 - as you see it numbered 3) receives data (2.2) from t2p1 process and multiplies it with 2.3 and sends the result of the multiplication (5.06) to the t2p2 process. The last process (t2p2) does nothing else that receives data from t2p1 and t2p3 processes and prints data values on the consol. It means than it calls a special GRP function that sends data to server program and server prints it on the screen. The processes are not able to print any data on the screen directly. They have to send their print requests to server program.
Result of the program execution and with verbose mode.

Test of nested program blocks

Result of the program execution and with verbose mode.

Test of the ALT construction

This example is designed to test ALT construction. It contains three processes. Process number 1 sends one integer and one double type data to process 3. It executes sending by 10 times using a loop. Process number 2 similar to process 1, but it sends two integer and two double data to the process 3. Process number 3 runs a loop by 20 times. There is a CAIALT block in the loop, that scanes ports that make connection to process 1 and 2.

Graphical representation of the program:

Result of the program execution and with verbose mode.
Back to Grapnel Compiler.