` What is CPL? CPL

What is CPL?

Three-letter acronyms collect many meanings. CPL has dozens, for instance several City Public Libraries, a few Cricket Premier Leagues, a Commercial Pilot License, a Microsoft Windows Control PaneL file, and a handful of programming languages among which a historical ancestor of BCPL and C. Intended here is a fivefold expansion:

This CPL, unrelated to the Cambridge or Combined Programming Language, is a general-purpose programming language akin to FORTRAN or C (∗∗p).col=j; p=&(∗∗p).next; p.col=j p=p.next (but in fact even more similar to the once popular Pascal and Modula-2, for those who remember them), with some unique features. It was born out of the effort to provide the pointer flexibility of C without the bookkeeping of ∗'s and &'s, the function overloading of C++ without the scaffolding of classes, and the function prototypes of Modula-2 (and most modern languages) without the need for dedicated header or interface files.

It also aims for the ease of use of interpreted languages like MATLAB or Python, without giving up the error-catching benefits of mandatorily declared variables and the sheer speed of compiled execution. CPL was thought out as a compiled language from the very beginning; > makecpl Helloworld > ./Helloworld Hello world! when used for computationally intensive tasks, it inherits the speed of compiled C. In fact, its compiler is implemented as a nimble source-to-source translator which then invokes the system C compiler; this action, as well as the re-making of any required modules that were modified in the meanwhile, occurs behind the scenes at a single makecpl command. Later the icpl interpreter was also developed, with the ability to run a combination of interpreted and compiled CPL modules, as well as any function provided by an existing C library, interactively from its console.

CPL arrays STRUCTURE(REAL a,b,c) s(-2..8) REAL v(-9..15,1..7) s(-1..5).a=2*v(-2..4,6) allow variable as well as constant lower and upper bounds of each index, and are (on request) fully bounds-checked. An ample set of subarray selections is efficiently supported and transparent to structure fields.

The CPL compiler's most distinctive feature is its incremental extensibility. The included libraries can thus provide matrix operations, gnuplot graphics, and symbolic manipulation, USE lapack-eigenvalues A=[(1.,2.),(3.,4.)] WRITE eigenvalues(A) just to name three examples, all blended into the language syntax. Additionally, any function provided by an external C or FORTRAN library can be seamlessly called inside a CPL program (or from the icpl command line), giving access to a large number of public and proprietary libraries alike. And to encapsulate a (e.g. LAPACK) call in a CPL wrapper, as exemplified in this lapack Tutorial, simplifies syntax and exacts no performance penalty.

To cap this bird's-eye presentation, a hallmark aesthetic touch of CPL is the availability of all three kinds of round, square, and curly brackets for grouping arithmetic (or other) expressions, p(i)=EXP(-{[x(i)-mu]/sigma}^2/2) just as you were taught in school. While to alternate parentheses, brackets and braces is optional and might be unessential to some, to do so eases the human eye's reading and proofreading nested formulas; and it enhances automatic error catching too. The provided text editor can automatically complete parentheses and alternate bracket styles for you.