Component Oriented Programming Paradigm

Parham is a pure component oriented programming language.

A Parham program is a collection of components. Every component is implemented as a separate file.

Interaction with C Language

In the current version of the Parham compiler, it is possible that a Parham program calls C functions or a method of a Parham component is called from a C function.

Hello World Program

In this sample, the overall syntax of the language is explored.

Moreover, the way that the language interacts with the C programming language is explored too.

The program has two files.

  • A Parham file defining HelloWorld component
  • A C file defining printing function (cprint)

The first line of the Parham file specified the name of the component (HelloWorld).

Then, it has the prototype of cprint function. The function prototype is prefixed with foreign keyword specifying that the function is implemented in C.

Finally, the component main component is provided. Again, it has a foreign modifier to emphasize that it is called from C (operating system loader).

The body of the function calls cprint to print the “Hello World!” message.

HelloWorld

foreign void cprint (char[] msg);

foreign int main ()

{

    cprint (“Hello World!n”);

}

HelloWorld Component

#include <stdio.h>

void cprint (char *msg)

{

   printf (“%s\n”, msg);

}

cprint.c file