Sujet : Re: Top 10 most common hard skills listed on resumes...
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.lang.cDate : 29. Aug 2024, 09:41:39
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vapc83$3tes2$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0
On 28/08/2024 15:51, Bart wrote:
On 28/08/2024 12:21, Michael S wrote:
On Sun, 25 Aug 2024 18:26:57 +0100
Bart <bc@freeuk.com> wrote:
>
On 25/08/2024 17:20, tTh wrote:
On 8/25/24 17:30, Bart wrote:
>
So what language goes between Assembly and C?
>
Forth ?
>
I had in mind languages classed as 'HLLs'. I'm not sure if Forth
counts.
>
>
They say that Forth is a HLL
https://www.forth.com/forth/
I tend to agree with them.
From 'forth.com', and a commercial site at that? They're going to be completely impartial of course!
This is the Ackermann function in Forth, from https://rosettacode.org/wiki/Category:Forth :
: acker ( m n -- u )
over 0= IF nip 1+ EXIT THEN
swap 1- swap ( m-1 n -- )
dup 0= IF 1+ recurse EXIT THEN
1- over 1+ swap recurse recurse ;
Well, it's not assembly, but it doesn't have one characteristic of HLLs which is readability. The code for Ackermann can usually be trivially derived from its mathemetical definition; not so here.
Yoda you are if Forth readable then.
More seriously, Forth has a very consistent stack-based and post-fix notation. Round parenthesis are used for comments - knowing that little fact makes a huge difference when you are trying to read it! White space is essential between words, but the amount and type of white space doesn't matter. And a "word" can be pretty much any combination of letters, numbers, punctuation, etc. Even integer constants (which are either a sequence of integers or an 0xabcd style hex constant, optionally preceded by a minus sign) can be redefined as words. It is not really a good idea to do that, however.
So I say it fails the HLL test. But if it's not a HLL, it's also fails on low-level control: the above doesn't concern itself with types or bitwidths for example; you might consider that a HLL trait, but it's one that belongs the other side of C rather than below.
Types are high level concepts - Forth does not have them as such. (There are ways to make something like C structs, and you can build up higher-level features from Forth fundamentals, but this is not the newsgroup for the details of that. Plus, I have no idea how to do it and would have to look it up!) It is also fairly unstructured as a language - words (functions) can add or remove data from the stack, and they do not have to do so consistently for all paths through the code.
Forth cell sizes are typically the same size as C "int" on the same target. (There is no direct connection here, but the same reasoning about range and efficiency applies to both languages.) For other sizes, specific operators are used since there are no types. But you most certainly can operate on data of different bitwidths, and access memory at specific addresses, as required for low-level work.
Forth is not a very popular language these days, but much of its use has been in low-level work and embedded systems - that's certainly where you will find many Forth tools. For /really/ small microcontrollers, such as the 4-bit devices that used to dominate in numbers while remaining almost hidden to most developers, the assembly /is/ Forth. And in most Forth systems, you have not only support for embedded assembly, but the assembler itself is built in (using Forth-style syntax).
One of the important uses of Forth was to have drivers for hardware devices and plug-in cards for workstations, because the code could be very compact, easily stored in a small serial rom/flash device, fully independent of the processor in workstation, and mostly independent of the OS in the workstation. Of course, that changed with as the Windows/x86 trashed the workstation market and replaced 10 KB of portable Forth driver code with 100+ MB of Windows-specific crapware for a simple network card.