Opentopia Directory Encyclopedia Tools

Ch interpreter

Encyclopedia : C : CH : CHI : Ch interpreter



 

Ch, pronounced as C H, is an embeddable C/C++ interpreter. Ch is designed for using one C compatible language for all programming tasks.

Ch programming language extends C and C++ for scripting, numerical computing and 2D/3D plottings and embedded scripting. It can run in Windows, Linux x86, Linux PPC, Solaris, HP-UX, Mac OS X, FreeBSD and QNX.

Features

C/C++ compatible interpreter

Ch supports 1999 ISO C Standard (C99) and C++ classes. It is superset of C with C++ class. C99 major features such as complex numbers, variable length arrays (VLAs), IEEE-754 floating-point arithmetic, generic mathematical functions in C99 are supported. Wide characters in Addendum 1 for C90 is also supported.

Embeddable scripting

As a C/C++ interpreter, Ch can be used as a scripting engine for your applications. It extends your applications with C compatible scripting language.

Shell programming and cross-platform scripting

Ch is a C-compatible shell similar as C-shell (csh). It can be used as login shell as well. Ch has a built-in string type for auto memory allocation and de-allocation. It makes scripting easier.

2D/3D plotting and numerical computing

Ch has built-in 2D/3D graphical plotting features and computational arrays for numerical computing. Linear system equation b = A*x can be written verbatim in Ch.

Examples

\"Hello, world!\" in Ch

There are two ways to run Ch code. One is:

#!/bin/ch
printf("Hello world!\n");
Another is:

#!/bin/ch
#include 
int main() 
Note: #!/bin/ch is optional.

Numerical computing in Ch

#include 
#include 
int main() ;
array double B[3][2]
printf("A= \n%f \n", A+A);
B = 2*transpose(A);
printf("B= \n%f \n", B);
}
The output is:

A=
2.000000 4.000000 6.000000
8.000000 10.000000 12.000000
B=
2.000000 8.000000
4.000000 10.000000
6.000000 12.000000

Shell programming

Find and compile all .c files into .o in the current directory when the .o is old or absent.

#!/bin/ch
#include <sys/stat.h>
struct stat cstat, ostat;
string_t c, o;
foreach (c; `find . -name "*.c"`)

}

2D/3D plotting in Ch

To plot a sine wave:

#include 
#include 
int main() 

External links

 


From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.


Search Titles
0123456789
ABCDEFGHIJ
KLMNOPQRST
UVWXYZ?

E-mail this article to:

Personal Message: