Deutsch   English   Français   Italiano  
<vblie8$2dpn7$1@paganini.bofh.team>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail
From: Waldek Hebisch <antispam@fricas.org>
Newsgroups: comp.lang.c
Subject: Re: Top 10 most common hard skills listed on resumes...
Date: Mon, 9 Sep 2024 01:19:06 -0000 (UTC)
Organization: To protect and to server
Message-ID: <vblie8$2dpn7$1@paganini.bofh.team>
References: <vab101$3er$1@reader1.panix.com>   <87v7zjuyd8.fsf@bsb.me.uk> <20240829084851.962@kylheku.com> <87mskvuxe9.fsf@bsb.me.uk> <vaq9tu$1te8$1@dont-email.me> <vbci8r$1c9e8$1@paganini.bofh.team> <vbcs65$eabn$1@dont-email.me> <vbekut$1kd24$1@paganini.bofh.team> <vbepcb$q6p2$1@dont-email.me> <vbgb5q$1ruv8$1@paganini.bofh.team> <vbhbbb$1blt4$1@dont-email.me> <vbipp5$24kl5$1@paganini.bofh.team> <vbk0d9$1tajm$1@dont-email.me> <vbkpfc$27l2o$1@paganini.bofh.team> <vbl0rh$21tps$1@dont-email.me>
Injection-Date: Mon, 9 Sep 2024 01:19:06 -0000 (UTC)
Injection-Info: paganini.bofh.team; logging-data="2549479"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A";
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.9.3
Bytes: 7566
Lines: 147

Bart <bc@freeuk.com> wrote:
> On 08/09/2024 19:13, Waldek Hebisch wrote:
>> Bart <bc@freeuk.com> wrote:
>>> On 08/09/2024 01:05, Waldek Hebisch wrote:
>>>> Bart <bc@freeuk.com> wrote:
>>>
>>>>> Then you no longer have a language which can be implemented in a few KB.
>>>>> You might as well use a real with with proper data types, and not have
>>>>> the stack exposed in the language. Forth code can be very cryptic
>>>>> because of that.
>>>>
>>>> First, it is not my goal to advocate for Forth use.
>>>
>>> You're doing a fine job of it!
>>>
>>> For me it's one of those languages, like Brainf*ck, which is trivial to
>>> implement (I've done both), but next to impossible to code in.
>> 
>> I wonder if you really implemented Forth.  Did you implement immediate
>> words? POSTPONE?
> 
> I implemented a toy version, with 35 predefined words, that was enough 
> to implement Fizz Buzz. Then I looked for more examples to try and found 
> they all assumed slightly different sets of built-ins.

OK, so apparently you missed essential part.

>> define fibr(n);
>>      if n < 2 then 1 else fibr(n - 1) + fibr(n - 2) endif
>> enddefine;
> 
>> There are some anomalies, assignment is written as:
>>
>> a -> b;
>>
>> which means assign a to b.
> 
> This POP11 seems a more viable language than Forth. (I vaguely remember 
> something from college days, but that might have been POP2.)

Pop11 was created in Great Britain, originally 11 refered to PDP-11,
it was port (with modifications) of Pop-2.  Main site was Sussex,
but is was used in several other places.

>> external declare tse in oldc;
>> 
>> void
>> tse1(da, ia, sa, dp, ip, sp, d, i, s)
>>      double da[];
>>      int ia[];
>>      float sa[];
>>      double * dp;
>>      int * ip;
>>      float * sp;
>>      double d;
>>      int i;
>>      float s;
>> {
>> }
>> 
>> endexternal;
>> 
>> The first line switches on syntax extention and lines after that
>> up to 'endexternal' are parsed as C code.  More procisely, 'oldc'
>> expects KR style function definitions (with empty body).  As
>> result this piece of code generates Pop11 wrapper that call
>> corresponding C routine passing it arguments of types specified
>> in C definition (but on Pop11 side 'double da[]' and 'double * dp'
>> are treated differently).  Note that this in _not_ a feature of
>> core Pop11 langrage.  Rather it is handled by library code (which
>> in principle could by written by ordinary user.
> 
> I don't quite understand that. Who or what is the C syntax for?

It is information for Pop11 about signature of a C function.  Since
KR C did not have prototypes, construction above uses definition with
empty body.  Basically, you take C source of your function and
cut first part of old style definition up to opening brace, paste
this int Pop11 file, add closing brace.  Ater that you have
declaration for Pop11 compiler.

> Does POP11 transpile to C?

No.  The whole system is called Poplog and in interactive use
compiles to memory (one can save memory and load it later).
There is compiler compiling Pop11 extended with low-level
constructs, this compiler generates assemby which in turn gives
object files (there is extra file to containg extra Pop11 information,
needed for linking).

> Usually the FFI of a language uses bindings expressed in that language,

Pop11 takes information from C-like code.  Maybe I should have used
modern style, then you just take prototype from a C headers.

> and is needed for the implementation to generate the correct code. So 
> it's not clear if calls to that function are checked for numbers and 
> types of arguments.

Pop11 is dynamically typed.  The 'external declare' construct generates
Pop11 function with the same number of arguments as the C function.
This Pop11 function converts Pop11 arguments to right C types if possible,
otherwise signals error.  Then it calls C function (which must be
loaded from some shared library, I did not show library loading).
When C function returns, return value is convered to Pop11
representation.

>> Pop11 has very similar semantics to Lisp and resonably traditional
>> syntax.  I would say that Lisp users value more extensibility than
>> traditional syntax.  Namely Lisp macros give powerful extensibility
>> and they work naturaly with prefix syntax.  In particular, to do
>> an extension you specify tree transformation, that is transformation
>> of Lisp "lists", which can be done conveniently in Lisp.  In Pop11
>> extentions usually involve some hooks into parser and one need to
>> think how parsing work.  And one needs to generate representation
>> at lower level.  So extending Pop11 usualy is more work than extending
>> Lisp.  I also use a language called Boot, you will not like it
>> because it uses whitespace to denote blocks.  Semantics of Boot is
>> essentially the same as Lisp and systax (expect for whitespace)
>> is Algol-like.
> 
> One of yours? A search for Boot PL didn't show anything relevant.

Boot is invention of IBM research lab.  It only current use is
implementing a computer algebra system.  If interested look for
FriCAS, about 60 kloc is in Boot.

>> One of my early program did recursive walk on a graph.  Goal was
>> to do some circuit computation.  I did it in Basic on ZX 81.
>> I used GOSUB to do recursive calls, but had to simulate the argument
>> stack with arrays.  This led to severl compilcations, purely
>> because of inadequacy of the language.
> 
> On ZX81? I can imagine it being hard! (Someone wanted me to do something 
> on ZX80, but I turned it down. I considered it too much of a toy.)

To give more background, bare ZX81 had 1kB RAM (including video RAM).
I used version with external 64 kB memory module, so I had 56 kB
usable RAM (8 kB of address space was taken by ROM).  So in fact
resonably powerful machine.  There was a printer using special paper
(silver looking).  The only mass storage availble was on cassete.
And worse, the only language available was Basic in the ROM.

With bare version I would not try, it was clear to me that it was
impossible to put this program in 1kB.

-- 
                              Waldek Hebisch