` 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 hindrance of ∗'s and &'s, the function overloading of C++ without the scaffolding of classes, and the cross-file prototype checking 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; when used for computationally intensive tasks, it inherits the speed of compiled C. > cpl make Helloworld > ./Helloworld Hello world! In fact, its compiler is implemented as a nimble and fast source-to-source translator which then invokes the system C compiler; this action, as well as the re-making of any modified modules, occurs behind the scenes at a single cpl make command. Even this command can be spared, if desired, by embedding cpl run in the program itself for immediate execution. Later in development the interactive cpl interpreter was added, with the ability to run a combination of interpreted and compiled CPL modules, as well as any function provided by an existing CPL or C library, directly 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) var=SUM [v(i,j)-m]^2 FOR ALL i,j allow variable lower and upper bounds of each index, and are (on demand) fully bounds-checked. An ample set of subarray selections, commuting with structure fields, is efficiently supported.
A gamut of shorthand loops is enabled by the implicit handling of array bounds.

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 cpl i 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 users, 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.