Component Oriented Programming Paradigm
Parham is a pure component oriented programming language.
A Parham program is a collection of components. A component can use other components to provide its service.
The application itself is a component which is called the main component. The main component has a main function (like C, C++, etc.) that the execution of program begins from it.
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 Parham, every component is implemented as a separate file.
The file begins with the name of the component.
In this sample, a simple program is developed to print “Hello World!”. It has just one component which is the main component. It is named: “HelloWorld”.
It has two methods: cprint and main. cprint is implemented in C and is called from Parham. Therefore, it has a “foreign” modifier. The body of cprint is provided in C. It just calls printf to print a message on output. Currently Parham
does not have I/O functions itself. Therefore, it uses C language libraries for this purpose.
The other method of the HelloWorld component is main. This is the method of the program that the execution of the program begins from it. Again, it has a foreign modifier to show that it is called from C (the loader of operating system).
The program has two files.
The link of the complete source of the sample is provided at the beginning of this sample.
foreign void cprint (char msg);
foreign int main ()
cprint (“Hello World!n”);
void cprint (char *msg)
printf (“%s\n”, msg);