Liste des Groupes | Revenir à cl c |
Bart <bc@freeuk.com> wrote: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.On 08/09/2024 01:05, Waldek Hebisch wrote:I wonder if you really implemented Forth. Did you implement immediateBart <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.
words? POSTPONE?
define fibr(n);> There are some anomalies, assignment is written as:
if n < 2 then 1 else fibr(n - 1) + fibr(n - 2) endif
enddefine;
external declare tse in oldc;I don't quite understand that. Who or what is the C syntax for? Does POP11 transpile to C?
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.
One of yours? A search for Boot PL didn't show anything relevant.Most people prefer to code in a HLL.You mean "most people prefer by now traditional syntax", sure.
But this at least shows Lisp asPop11 has very similar semantics to Lisp and resonably traditional
being higher level than Forth, and it's a language that can also be
bootstrapped from a tiny implementation.
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 my early program did recursive walk on a graph. Goal wasOn 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 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.
I'll reply to that separately.You're taking all those, to me, chaotic features of C as being superiorLook at this C code:
to Pascal.
>
Like being able define anonymous structs always anywhere, or allowing
multiple declarations of the same module-level variables and functions.
OK, there's that too, although it's not something I used. (I last used actual Pascal c. 1980, and didn't try it again for 35+ years with FreePascal.)In my hands I would have given it some tweaks to make it aFor system programming Turbo Pascal had what is needed.
viable systems language. For a better evolution of Pascal, forget Wirth,
look at Ada, even thought that is not my thing because it is too strict
for my style.
Confusing noise: in A = .B, why doesn't A need the dot too? (This has been discussed at length so is rhetorical!)Syntax IS superficial! But it's pretty important otherwise we'd beWell, even in context of systax dot required by Bliss is little thing,
programming in binary machine code, or lambda calculus.
just a bit of mandatory noise.
Concerning Forth and Lisp, some people like such syntax and there areIn the Reddit PL forum people absolutely love weird and esoteric syntax. The harder to understand the better. Loads of pointless punctuation is especially popular.
gains.
The HLA I implemented for PDP10 looks somewhat odd, but still nothing like assembly. Assignment was LTR:In first approximation HLL = not(assembly). Of course (binary, octal,I am not going to write substantial programs in Bliss or Forth>
but I have no double they are HLL-s.
So, what would a non-HLL look like to you that is not actual assembly?
etc) machine language counts as assembly for purpose of this equation.
And some language like PL360 or Randall Hyde HLA which have constructs
which does not look like assembly still count as assembly. Similarly
macro assemblers like IBM HLA count as assembly. Fact that there is
a complier that turns IBM HLA Javascript, so that you can run it on
wide range of machines does not change this. For me what count is
thinking and intent: using IBM HLA you still need to think in term
of machine instructions. One can use macro assemblers to provide
set of macros such that user of those macros does not need to think
about machine instructions. IIUC one of PL/I compilers was created
by using a macro assembler to implement a small subset of PL/I, and
then proper PL/I compiler was written in this subset. But this
is really using macro assembler to implement different language.
In other words, once extentions can function as independent language
and users are encouraged to think in terms of new language,
this is no longer assembler, but a new thing.
Just as an extra explanantion, I read HLL as Higher Level Language,
with Higher implitely referencing assembly. So it does not need
to be very high level, just higher level than assembly.
Les messages affichés proviennent d'usenet.