Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #22216
| From | "Rod Pemberton" <do_not_have@notemailnotq.cpm> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: are forthers still unimpressed with go lang? |
| Date | 2013-05-03 16:07 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <km158i$3lv$1@speranza.aioe.org> (permalink) |
| References | <4cf6d874-adaa-4dc0-9ff4-7a8d45dc455c@googlegroups.com> <klr03f$isv$1@speranza.aioe.org> <_b-dnTif5YYWsxzMnZ2dnUVZ_qidnZ2d@supernews.com> <72351a29-1334-4832-86ff-92186fdf0ef4@tz3g2000pbb.googlegroups.com> |
"Hugh Aguilar" <hughaguilar96@yahoo.com> wrote in message
news:72351a29-1334-4832-86ff-92186fdf0ef4@tz3g2000pbb.googlegroups.com...
> On May 1, 8:02 am, Andrew Haley
<andre...@littlepinkcloud.invalid>
> wrote:
...
> > Rod Pemberton <do_not_h...@notemailnotq.cpm> wrote:
> > > Go is one just more example of a language that is compiled
> > > to C,
> >
> > No it's not. There's a real GCC front end for it. It doesn't
> > get compiled into C.
It does. It was done once but manually for all the syntax of a
language. One can't create a GCC front-end without doing so.
> > > but this time by a C++ front end called gccgo...
> >
>
> There are actually two Go compilers available. One of them is a
> front- end to GCC. As Andrew states, this does NOT mean that it
> compiles into C source-code and then a C compiler compiles that
> into machine-code.
My reply was to be to Andrew, but I didn't manage to get it sent
out. Most of this is a new reply. However, this part covers some
of the same or a similar response.
It really doesn't matter whether you look at the high-level
overview, i.e., compiles into C, or you switch topics to the
actual low-level implementation specific details. The result and
process is the same or nearly so. The code is parsed and
represented as either C or a representation of C. To do that, at
some point it was converted to C, even if that was only once.
In the high-level perspective, the Go code goes through this
process (basically):
Go -> emitted as C
GCC C front end -> parses C into a C compatible AST
GCC backend ->
converts AST to RTL,
RTL optimizer,
RTL to assembly,
assembly to binary
In the low-level perspective, the code goes through this process
(basically):
GCC Go front end -> parses Go into a C compatible AST
GCC backend ->
converts AST to RTL,
RTL optimizer,
RTL to assembly,
assembly to binary
FYI, RTL is Register Transfer Language, which is an intermediate
assembly language.
FYI, AST is Abstract Syntax Tree, which, in general, is a tree
structure with nodes that are unions, in the C sense, i.e.,
multiple data types stored in the same data space. The AST
represents the semantic information of the code without the
syntax. This is roughly equivalent to a portion of the
functionality of a Forth dictionary.
With -O1, -O2, and -O3 optimization, the code is roughly 90%, 95%,
99% the same. The only real difference is whether there is a file
of actual emitted C code or not. In both cases, the Go code is
still converted to C, and is still represented as C. Why?
Because, the AST for GCC was designed to represent C code. I.e.,
to write a Go front end for C one converts the Go code into
equivalent C code for all the syntactic elements of Go. Next, the
equivalent C code for Go is parsed by GCC's C front end. This
allows the Go front end programmer to determine which C nodes are
needed for the C compatible AST, how they are linked, and how they
are populated. Finally, the Go front end programmer codes his/her
parser to create those C nodes. These C nodes in the AST
represent the equivalent C code for the Go code. The Go code is
still C code as a parsed AST. C code or representations of it is
what GCC handles.
This is where they tell you GCC only handles an AST for C, but
that it can be used for similar languages, i.e., those compileable
to C...
http://gcc.gnu.org/onlinedocs/gccint/Languages.html#Languages
This is where they tell you that the Go types map directly to C
code. I.e., this is likely some of C code they used for Go
constructs to create the Go front end.
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gccgo/C-Type-Interoperability.html#C-Type-Interoperability
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gccgo/Function-Names.html#Function-Names
> It compiles into some kind of intermediate format, which the GCC
> back-end then compiles into machine-code.
Not to be pedantic, which is why Andrew got in this... He decided
to switch from a general overview to specific low-level details.
But, they're the same either way.
However, it's not "compiles into" as you've stated. It's not
"some kind of..." It's parsed into an AST. That's the IR
(Intermediate Representation). That gets converted to RTL.
That's GCC's internal assembly language.
> Go is derived from C, [...]
> Go is a lot different from C, [...]
I don't follow that reasoning, ... at all.
If Go can be converted to C, and the C code does the exact same
thing as the Go code, how is it that it's "alot" different than C?
The *identical* thing is accomplished. So, it seems to be
identical to me. The only difference is the syntax or lack of.
Isn't that the same basic argument that's being here to justify
Forth not having or using syntax? ... I.e., everyone c.l.f. as a
group please say this in unison: "Forth can do what C does and we
don't need the stinking syntax!" ;-) You've done so in the
past...
> [...]
> --- obviously, the people who designed Go thought that C had
> problems, or they would have just stuck with C --- [...]
Who doesn't think C has problems? I know of *numerous* problems.
I've stated many of them here. They're just insignificant or mild
irritants. All good tools have some sharp edges. That's true
even of a hammer...
> I don't actually have anything against C or C-like languages
> such as Go.
I won't spend my day to fill this reply up with the all the stuff
on c.l.f. and c.l.a.x. by you that contradicts this ...
> I do object to Rod's claim that C is the "god language"
> --- what a dumb claim that is!
AIR, I provide proof to you (and others here) that nearly all
languages are or have been compiled to C, and all major languages
of use today are C derivatives (currently, over 61%). So, from my
perspective, it's only a "dumb" claim if you fail to accept the
truth or reject it. C and Forth are the most ubiquitous
languages. I've stated that numerous times here. I.e., they're
really the only two choices for a back end for other languages,
once you reject assembly. So, when all other languages are
compiled to Forth or built on a Forth back-end, then you can claim
Forth is the "god language". Until then, my claim stands as
valid.
Rod Pemberton
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
are forthers still unimpressed with go lang? the_gavino_himself <visphatesjava@gmail.com> - 2013-04-30 15:12 -0700
Re: are forthers still unimpressed with go lang? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-04-30 20:52 -0700
Re: are forthers still unimpressed with go lang? the_gavino_himself <visphatesjava@gmail.com> - 2013-05-03 15:59 -0700
Re: are forthers still unimpressed with go lang? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-05-01 08:02 -0400
Re: are forthers still unimpressed with go lang? Mark Wills <forthfreak@gmail.com> - 2013-05-01 05:33 -0700
Re: are forthers still unimpressed with go lang? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-01 10:02 -0500
Re: are forthers still unimpressed with go lang? Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-05-01 15:28 -0700
Re: are forthers still unimpressed with go lang? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-05-03 16:07 -0400
Re: are forthers still unimpressed with go lang? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-03 17:49 -0500
Re: are forthers still unimpressed with go lang? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-05-05 00:51 -0400
Re: are forthers still unimpressed with go lang? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 04:12 -0500
Re: are forthers still unimpressed with go lang? hughaguilar96@yahoo.com - 2013-05-06 23:17 -0700
Re: are forthers still unimpressed with go lang? AKE <assadebrahim2000@gmail.com> - 2013-05-07 10:36 -0700
Re: are forthers still unimpressed with go lang? "Rod Pemberton" <do_not_have@notemailnotq.cpm> - 2013-05-07 18:57 -0400
Re: are forthers still unimpressed with go lang? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-08 02:54 -0500
Re: are forthers still unimpressed with go lang? Paul Rubin <no.email@nospam.invalid> - 2013-05-08 02:03 -0700
Re: are forthers still unimpressed with go lang? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-08 12:18 -0500
Re: are forthers still unimpressed with go lang? hughaguilar96@yahoo.com - 2013-05-08 20:53 -0700
Re: are forthers still unimpressed with go lang? the_gavino_himself <visphatesjava@gmail.com> - 2013-05-07 14:25 -0700
Re: are forthers still unimpressed with go lang? the_gavino_himself <visphatesjava@gmail.com> - 2013-05-03 16:00 -0700
csiph-web