Hubbry Logo
Ch (computer programming)Ch (computer programming)Main
Open search
Ch (computer programming)
Community hub
Ch (computer programming)
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Ch (computer programming)
Ch (computer programming)
from Wikipedia
CH C/C++ interpreter
Original authorHarry H. Cheng
DevelopersSoftIntegration, Inc.
Initial releaseOctober 1, 2001; 24 years ago (2001-10-01)
Stable release
8.0.0 / November 19, 2017; 7 years ago (2017-11-19)
Written inC
Operating systemWindows, OS X, Linux, AIX, HP-UX, Solaris (SPARC and x86), QNX, FreeBSD
Platformx86, SPARC
Available inEnglish
TypeIntegrated development environment
LicenseProprietary software
Standard edition: freeware
Student edition: freeware for students
Professional edition: trialware for 30 days
Websitewww.softintegration.com

CH /ˌsˈ/ is a proprietary cross-platform C and C++ interpreter and scripting language environment. It was designed by Harry Cheng as a scripting language for beginners to learn mathematics, computing, numerical analysis (numeric methods), and programming in C/C++. Ch is now developed and marketed by SoftIntegration, Inc.. Free versions include the student edition, and the non-commercial Professional Edition for Raspberry Pi.

CH can be embedded in C and C++ application programs. It has numerical computing and graphical plotting features. CH is combined of both shell and IDE.[1] CH shell combines the features of common shell and C language.[2] ChIDE provides quick code navigation and symbolic debugging. It is based on embedded CH, Scite, and Scintilla.[3][4]

CH is written in C and runs on Windows, Linux, macOS, FreeBSD, AIX, Solaris, QNX, and HP-UX. It supports C90 and major C99 features, but it does not support the full set of C++ features. C99 complex number, IEEE 754 floating-point arithmetic, and variable-length array features were supported in CH before they became part of the C99 standard.[5][6][7][8] An article published by Computer Reseller News (CRN) named CH as notable among C-based virtual machines for its functionality and the availability of third-party libraries.[9]

CH has many tool kits that extend its functions. For example, the CH Mechanism Toolkit is used for design and analysis of commonly used mechanisms such as four-bar linkage, five-bar linkage, six-bar linkage, crank-slider mechanism, and cam-follower system.[10] CH Control System Toolkit is used for the design, analysis, and modelling of continuous-time or discrete-time linear time-invariant (LTI) control systems.[11] Both tool kits include the source code.

CH has been integrated into free C-STEM Studio, a platform for learning computing, science, technology, engineering, and mathematics (C-STEM) with robotics. C-STEM Studio is developed by the UC Davis Center for Integrated Computing and STEM Education, offering a curriculum for K-12 students.

CH supports LEGO Mindstorms NXT and EV3, Arduino, Linkbot, Finch Robot, RoboTalk and Raspberry Pi, Pi Zero, and ARM for robot programming and learning.[12][13][14] It can also be embedded into the LabVIEW system design platform and development environment.[15]

Features

[edit]

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

C++ features available in CH include:

CH supports classes in C++ with added abilities, including:

  • Classes inside member functions
  • Nested functions with classes
  • Passing member function to argument of pointer-to-function type of functions

CH can interact with existing C/C++ libraries and call C/C++ functions from CH script.[16] As a C/C++ interpreter, CH can be used as a scripting engine and extension language for applications. Pointers to arrays or variables can be passed and shared in both C-compiled and CH scripting contexts. One example of an embedded CH scripting application is Mobile-C, which has been used for collaborative visualization of distributed mesh model.[17][18][19]

CH has a built-in string type (string_t) for automatic memory allocation and de-allocation. It supports shell aliases, history, and piping.[20][21]

CH has built-in 2D/3D graphical plotting features and computational arrays for numerical computing. A 2D linear equation of the form b = A*x can be written verbatim in Ch.[22]

See also

[edit]

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Ch is a proprietary embeddable C/C++ interpreter and designed as a superset of , enabling interactive execution of C and C++ code without compilation for tasks such as shell programming, numerical computing, and embedded scripting. Developed originally by Dr. Harry H. Cheng, a professor at the , Ch was created to bridge the gap between low-level C programming and high-level scripting environments, drawing influences from languages like , 90, and while maintaining full compatibility with the ISO C90 standard and most features, including complex numbers and variable-length arrays. The language supports a wide range of platforms, including Windows, Linux, macOS, Solaris, and embedded systems like Raspberry Pi and ARM-based devices, making it suitable for cross-platform development and education. Key extensions include nested functions, computational arrays for matrix operations, automatic memory management for strings, and built-in support for 2D/3D plotting via libraries like SoftIntegration Graphical Library, which facilitate scientific visualization and data analysis. Ch also integrates with external libraries such as POSIX, OpenGL, ODBC, and GTK+, allowing it to handle diverse applications from web programming and robotics to rapid prototyping in engineering. Since its inception in the , Ch has evolved with SoftIntegration, Inc. taking over development and releasing version 8.5 (as of ), which emphasizes embeddability and free non-commercial use on certain platforms like . It is particularly notable in educational contexts, such as the C-STEM curriculum at UC Davis, where it supports K-12 and university-level teaching of , math, and with tools like integration. Notable safety features, including array bound checking and a "safe" mode that disables pointers, make it accessible for beginners while preserving C's power for advanced users.

Introduction

Overview

Ch is a proprietary, cross-platform interpreter and environment for C and C++ , designed primarily for interactive computing, scripting, and numerical tasks. Developed by SoftIntegration, Inc. and originally designed by Harry H. Cheng, it was initially released on October 1, 2001. The primary goals of Ch include enabling beginners to learn C and C++ interactively through an accessible environment, supporting shell programming for and system tasks, and providing embedded scripting capabilities for integration into larger applications. These objectives address the limitations of traditional compiled C/C++ workflows by allowing immediate execution and testing of code without compilation cycles. A key differentiator of Ch is its integration of a shell (Ch shell), (ChIDE), and interpreter into a single cohesive environment, facilitating and in ways not typical for standard C/C++ tools. It complies with the standard and includes features for numerical computing, such as support for complex numbers and computational arrays.

History and Development

Ch, an embeddable C/C++ interpreter and , was originally designed and implemented by Dr. Harry H. Cheng, a in the Department of Mechanical and Aeronautical Engineering at the , to facilitate teaching introductory in C to students. The emerged around in response to the need for an interactive computing environment tailored to educational curricula, allowing students to execute C code incrementally without compilation, similar to interactive tools like but grounded in C/C++ standards. This academic origin addressed the limitations of traditional compiled C environments in classroom settings, where immediate feedback was essential for learning programming concepts. Commercialization began with the founding of SoftIntegration, Inc. in 1999, though the company focused on distributing Ch starting with its initial release, version 1.0, on October 1, 2001. SoftIntegration, headquartered in , positioned Ch as a cross-platform tool for scripting, numerical , and embedded applications, leveraging Cheng's to market it to educators, engineers, and scientists. Key milestones included version 3.0 in 2004, which added full support for the ISO standard, enhancing features like complex numbers and variable-length arrays for advanced numerical tasks. Later versions introduced C++ class support, beginning around and expanding in subsequent releases to include object-oriented capabilities such as nested classes and member function passing. Development continued with regular updates through the and , culminating in version 8.5, released on July 14, 2024, which includes updates for Mac OS X Sonoma compatibility, new functions like REPEAT_UNTIL, and enhancements for educational tools bundled in C-STEM Studio. As of November 2025, SoftIntegration maintains Ch for professional scripting and academic settings, with version 8.5 as the latest release. In the , Ch was integrated into C-STEM Studio, an open-source platform developed by Cheng's UC Davis C-STEM Center—founded in 2010—for K-12 STEM education, enabling block-based to text-based coding transitions with hardware like . This evolution reflects Ch's enduring role in bridging interactive computing with standard C/C++ for educational and practical applications.

Language Features

Core C/C++ Support

Ch provides support for most features of the ISO standard, allowing interpreted execution of standard C constructs without requiring compilation. This includes key features such as complex numbers via the <complex.h> header, variable-length arrays (VLAs) for dynamic sizing, inline functions for performance optimization, and designated initializers for structured data assignment. For instance, complex numbers enable mathematical operations on real and imaginary parts, as demonstrated in the following code snippet:

c

#include <complex.h> #include <stdio.h> int main() { double complex z1 = 1.0 + 2.0 * I; double complex z2 = 3.0 - 4.0 * I; double complex sum = z1 + z2; [printf](/page/Printf)("Sum: %f + %f i\n", creal(sum), cimag(sum)); return 0; }

#include <complex.h> #include <stdio.h> int main() { double complex z1 = 1.0 + 2.0 * I; double complex z2 = 3.0 - 4.0 * I; double complex sum = z1 + z2; [printf](/page/Printf)("Sum: %f + %f i\n", creal(sum), cimag(sum)); return 0; }

When executed interactively in Ch, this outputs "Sum: 4.000000 + -2.000000 i", showcasing immediate feedback on arithmetic. Ch also supports other enhancements like IEEE-754 (handling infinities and NaNs), long long integer types, mixing declarations with code, and type-generic functions from <tgmath.h> for polymorphic math operations across numeric types. These features ensure compatibility with modern C programming practices while maintaining an interpretive workflow that evaluates expressions line-by-line, unlike traditional compiled environments. In terms of C++ integration, Ch offers partial support focused on object-oriented essentials, including classes with encapsulation (public/private access), constructors and destructors, static members, the this pointer, scope resolution operator (::), and new/delete operators. Polymorphic mathematical functions and variable-argument lists are available, but general function and operator overloading are not supported. References and pass-by-reference semantics facilitate efficient parameter passing. Basic I/O streams like cout, cin, and endl from <iostream> are available for console interactions. Examples include defining a simple class:

c

class Point { private: double x, y; public: Point(double a = 0, double b = 0) : x(a), y(b) {} // Constructor double distance() { return sqrt(x*x + y*y); } // Member function }; int main() { Point p(3.0, 4.0); cout << "Distance: " << p.distance() << endl; // Outputs: 5 return 0; }

class Point { private: double x, y; public: Point(double a = 0, double b = 0) : x(a), y(b) {} // Constructor double distance() { return sqrt(x*x + y*y); } // Member function }; int main() { Point p(3.0, 4.0); cout << "Distance: " << p.distance() << endl; // Outputs: 5 return 0; }

This code runs interpretively in Ch, demonstrating encapsulation and overloading potential via member functions. However, advanced C++ elements like full templates, exceptions, and namespaces are not supported. Ch's interpretive nature allows for interactive, line-by-line evaluation of C/C++ code, providing immediate results and error feedback that is particularly useful for debugging and learning. Runtime diagnostics include detailed error messages, such as type mismatches or undefined variables, displayed directly in the console to aid rapid iteration without recompilation cycles. The Ch shell further extends core C/C++ syntax for command-line scripting, integrating shell commands with C constructs for tasks like file manipulation and process control. It supports piping (e.g., system("ls | grep .c") to filter files), input/output redirection (e.g., printf("output") > "file.txt" or command < input.txt), and environment variable handling via getenv("PATH") for reading and putenv("VAR=value") for setting. This enables hybrid scripts, such as:

c

#include <stdlib.h> int main() { char *path = getenv("PATH"); printf("Current PATH: %s\n", path); system("ls > files.txt"); // Redirect output to file return 0; }

#include <stdlib.h> int main() { char *path = getenv("PATH"); printf("Current PATH: %s\n", path); system("ls > files.txt"); // Redirect output to file return 0; }

Such integration allows seamless blending of C/C++ logic with shell operations, enhancing scripting productivity.

Extensions and Built-in Libraries

Ch extends the C/C++ language with specialized features for numerical computing, integrating libraries such as LAPACK and BLAS for linear algebra operations, including matrix inversion, decomposition (e.g., LU, QR, SVD), and solving linear systems via functions like linsolve(). It also incorporates statistical functions from the GNU Scientific Library (GSL), supporting tasks like numerical integration, optimization, and signal processing with operations such as cross-correlation (xcorr()) and Fast Fourier Transform (fft()). Matrix operations handle complex arithmetic, approximating IEEE 754 standards for floating-point behavior, including support for metanumbers like Inf, NaN, and complex variants, enabling element-wise computations on arrays declared as array double A[3][3]. For graphical plotting, Ch provides the CPlot class and high-level functions in chplot.h, enabling 2D and 3D visualizations directly within C code without external dependencies. This includes line plots via plotxy() for data like y = sin(x), surface rendering with plotxyzf() from array or file inputs, contour plots, and animations for dynamic sequences, such as real-time updates in simulations. Outputs can be exported to formats like , EPS, or , with features like autoscaling, legends, and annotations integrated seamlessly for inline use, as in plotting a immediately after computation. Additional extensions enhance scripting capabilities, including improved string handling with the string_t type for automatic and functions like stradd(), strjoin(), and strparse() for , tokenization, and parsing. Regular expressions are supported through regular expressions via regex.h for , allowing operations like string validation or extraction in scripts. Dynamic linking via dlopen() and dlsym() permits loading user libraries at runtime, facilitating modular extensions without recompilation. Embedded mathematical functions are native to the interpreter, offering type-generic operations for trigonometric (e.g., sin(), cos()), logarithmic (e.g., log(), exp()), and statistical computations (e.g., mean(), std()) that apply polymorphically to scalars, arrays, and complex numbers. This allows quick inline evaluations, such as sqrt(complex(1,2)) or array-wide factorial(), promoting efficient prototyping. A unique aspect of these extensions is their seamless integration, where numerical computations and plotting occur without external calls—for instance, solving a x = inverse(A) * b and immediately visualizing the results with plotxy(x, y).

Implementation

Architecture and Interpreter Design

The core interpreter of Ch is implemented in portable C, enabling cross-platform compatibility across Windows, Unix, and macOS without requiring platform-specific modifications. This design choice facilitates its embeddability as a C/C++ scripting engine, integrating seamlessly with existing C/C++ applications and libraries while maintaining a small footprint and avoiding intermediate or bytecode generation. Ch employs a lexical analyzer for tokenization and a to handle C/C++ syntax, including extensions like nested functions and variable-length arrays. The interpreter parses into an internal , enabling just-in-time evaluation that executes statements interactively without a separate compilation step, supporting both command-line and script modes for and . For embedding, Ch provides a C API that allows integration into host C/C++ applications, with functions such as ch_eval() for executing script strings directly and streval() for runtime evaluation of expressions. This mechanism supports bidirectional callbacks between the host environment and interpreted scripts, including tracing via callback functions, and enables multi-threading where a single interpreter can process multiple scripts concurrently or multiple interpreters can run in parallel. The Ch IDE (ChIDE) offers an integrated environment for editing, running, and debugging Ch scripts, supporting multi-language development with tools like and management. Complementing this, the Ch shell provides an interactive C-compatible with features such as command history, tab completion, aliasing, I/O redirection, and pipelines, mimicking Unix shells while enforcing C syntax for seamless scripting. Memory management in Ch combines automatic and manual approaches: strings and certain dynamic arrays receive automatic allocation and deallocation during interpretation, while pointers and user-defined objects use standard C functions like malloc(), free(), new, and delete for explicit control. This includes automatic initialization of variables to zero, array bounds checking, and a deallocate() function to reset pointers after freeing memory, ensuring safe handling of without garbage collection overhead. Ch's design philosophy centers on the "One Language for All" principle, striking a balance between C's low-level control—such as and pointer manipulation—and the ease of scripting languages, with an emphasis on real-time for numerical and scientific applications. By extending ISO C standards with features like nested functions and computational arrays, it promotes modularity and portability while eliminating compilation barriers to foster rapid development and educational .

Supported Platforms and Editions

Ch supports a wide range of operating systems, including Windows, Linux, macOS, Solaris (both SPARC and x64 variants), HP-UX, FreeBSD, QNX Neutrino RTOS, and various ARM-based distributions on single-board computers. It provides both 32-bit and 64-bit binaries, ensuring compatibility across modern and older hardware configurations, with recent updates confirming support for Windows 64-bit using Visual C++ 2022, Linux 64-bit kernels version 4.18.0 and higher, and macOS Sonoma 14. On the hardware front, Ch is compatible with x86 architectures and offers limited ARM support through ports optimized for devices like (including models Pi Zero, Pi Zero W), Orange Pi, and other ARM-based single-board computers running . It integrates with robotics platforms such as /EV3 and , allowing scripting for educational and prototyping applications without requiring compilation. Ch is available primarily in the Professional Edition, which is free for non-commercial use on and devices; commercial use on other platforms requires a , priced at $199 for commercial and $129 for academic use as of 2017. The Edition is free for educational purposes on Windows, , and macOS. All editions are , with trial versions available, and the latest release, version 8.5.0 from July 2024, maintains these licensing structures. Installation is straightforward for end-users, involving downloadable pre-compiled binaries from SoftIntegration's , eliminating the need for source compilation. As of 2025, Ch lacks native support for mobile platforms like or Android, and the core platform lineup has seen no major expansions since the 2017 alignment with version 8.0, though minor updates have enhanced compatibility with recent OS versions. It preserves with legacy Unix systems, including older Solaris, , and variants, allowing continued use in enterprise environments.

Applications and Uses

Educational Applications

Ch has been primarily utilized for interactive learning of C and C++ programming, eliminating compilation barriers to enable immediate execution of code, which facilitates hands-on experimentation for beginners. This approach has been integrated into UC Davis courses since its inception in the early , particularly in such as computer-aided , where students modify source codes to explore algorithms and solve practical problems. Since around 2010, Ch has been bundled with C-STEM Studio, a platform developed by the UC Davis C-STEM Center, to support K-12 STEM education. This integration allows teaching of , , and coding through both visual programming modes via RoboBlockly and textual C/C++ scripting with Ch, enabling students to control robots from vendors like , , and . Curriculum support for Ch includes textbooks such as Learning Computer Programming with Ch for the Absolute Beginner by Harry H. Cheng, which provides examples for numerical methods like solving quadratic equations and calculating averages, as well as plotting functions to visualize mathematical concepts such as trigonometric curves and linear trends. These resources align with State Standards for grades 4-9, emphasizing integrated math and computing. The advantages of Ch in education stem from its immediate execution, which reduces frustration for novices by providing instant feedback, and its graphical outputs, such as plots of derivatives or data curves, that enhance conceptual understanding of mathematics and engineering principles. A free student edition further promotes accessibility without licensing costs. Adoption of Ch extends to middle and high schools for introductory programming, with C-STEM Studio tested in approximately 200 K-12 schools, primarily in , as of 2015, as part of broader "Computer Science for All" initiatives. Ongoing activities include the 2025 C-STEM Conference for educators. Through these applications, Ch emphasizes by linking programming to real-world math and engineering problems, such as and , fostering problem-solving skills from an early age.

Professional and Scripting Uses

Ch serves as a powerful in professional environments, enabling the of repetitive tasks such as system administration, hardware testing, and through its interactive shell and support for over 250 Unix commands. The Ch shell allows engineers to execute C/C++ code directly without compilation, facilitating of scripts for file manipulation, , and cross-platform deployment in heterogeneous environments like Windows, , and embedded systems. In engineering and research, Ch is employed for numerical analysis and simulations, leveraging built-in computational arrays and integrations with libraries like GSL for statistical modeling and for linear algebra operations, which support solving differential equations and performing matrix computations efficiently. For instance, the Ch Control System Toolkit (CCST) provides scripting capabilities for designing and analyzing linear time-invariant s, including root locus plotting and pole placement, used in automation to process and in academic-industrial for real-time mechatronic applications. Embedding Ch into larger applications enhances professional workflows, particularly in and control systems, where it acts as a scripting for real-time command sequences without requiring build cycles, as demonstrated in RTLinux-based mechatronic setups for automated testing and . The Edition further supports unlimited runtime embedding and 2D/3D graphical plotting via integration, allowing engineers to visualize data pipelines in fields like and hardware interfacing, thereby reducing development time compared to traditional compiled C/C++ approaches. This combination of C/C++ performance with interpretive scripting makes Ch suitable for cross-platform automation in industries requiring high-speed numerical computations and . The latest version, Ch 8.5.0 released in July , continues to support these features.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.