The world outside of the Forth community divides programming languages into low level and high level languages. Assembly language represents low level environments because it is executed on bare metal while C is a well known example for a high level language because it is possible to write programs without knowing the underlying hardware. Even if Forth has some elements of high level languages it is an example for low level programming.
There are some reasons for the claim available that Forth belongs to the CPU First one is, that Forth was never standardized. It is not possible to run the same Forth source code on different machines. A jonesforth interpreter works different from Colorforth, and VFXforth has different keywords than gforth. The second cause why Forth belongs to bare metal programming is, that the most efficient Forth interpreter are realized in hardware. It was demonstrated in the past that Forth can be executed direct on a FPGA chip or on a custom cpu These cpu are realized with low amount of transistors. And the amount of possible Forth commands is low (fewer than 100).
The combination of low amount of Forth commands, the ability to run Forth direct on hardware and the missing standardization are typical sign to classify Forth as a low level bare metal language. To verify the thesis let us analyze some high level programming language.
The python programming language provides a huge amount of commands. If the user includes external libraries like pygame and Qt he gets access to 10000 and more different commands which are known as the api. These commands are realized in huge amount of codelines and are documented in long reference manuals. In addition the API is standardized. That means the user can execute the same program on different hardware and software environment. The assumption is that such a working mode is preferred by the user. That means, it is an advantage if python provides 10k different API calls because it simplifies the programming.
In contrast, Forth doesn't provide these features. Most Forth interpreters are provide to provide only a minimal set of commands. There is some sort challenge how to write a forth interpreter which needs less lines of code and which provide less commands.
Or let me explain it the other way around. It doesn't make sense to name a programming language a high level one, if it provides fewer than 100 commands. High level languages have always a standardized high amount of commands. This allows the programmer to formulate the source code in a more abstract way. While assembly like languages provide very few commands. It is possible to give an overview over an assembly language in a little paper which has 10 pages. In most cases, the commands are used to store values in registers, fetch values and add values.
No comments:
Post a Comment