Philosophical question about C

N

Nick

Borax Man said:
All code eventually ends up as machine code, even if it goes through
multiple passes to get there.

I'm with others who don't really agree with this for interpreted code.
Sure, all code leads to machine code being executed, but does that
really mean anything of any importance? After all, it all ends up as
micro code and as values on pins on ICs.

Is JVM code machine code? Would it be so if I built a machine that
executed it as the native machine code? Would it still be so if that
machine internally and in a non-accessible way converted it to Z80
assembler as a micro code? What about LISP machines?
 
P

Phil Carmody

Borax Man said:
All code eventually ends up as machine code, even if it goes through
multiple passes to get there.

Just because you repeat it doesn't make it true.

Consider an interpreter given different input programs A and B. After
they've done any pre-processing, be that just parsing, or p-coding,
then for one of them you have the interpreter and data representing A,
and for the other you have the interpreter and data representing B.
The machine code in the first example is that of the interpreter, and in
the second example it is that of the interpreter. The representations
of A and B are not machine code. Just because in order to complete the
execution you require the machine code of the interpreter does not
mean that the source programs have become machine code.

Phil
 
M

Michael Foukarakis

Just because you repeat it doesn't make it true.

Consider an interpreter given different input programs A and B. After
they've done any pre-processing, be that just parsing, or p-coding,
then for one of them you have the interpreter and data representing A,
and for the other you have the interpreter and data representing B.
The machine code in the first example is that of the interpreter, and in
the second example it is that of the interpreter. The representations
of A and B are not machine code. Just because in order to complete the
execution you require the machine code of the interpreter does not
mean that the source programs have become machine code.

You use an interesting expression; "...have become...". What does it
mean exactly, for a program to "become" something else? Is it
transformed by means of its own workings? Is it manipulated by forces
beyond its limited rules of comprehension; the Programmer, or the
Compiler, or the Interpreter? Surely, for the Interpreter to transmute
the Programmer's word into actions, certain "machine code" has to be
executed, does it not? One could say, with much certainty, that the
original program has "become" a much different series of instructions,
mandated now not only by the Programmer, but also the Interpreter (or
Virtual Machine, or whatever we decide to call It, at this point), and
they would be right, because the loose definition of the expression
"...have become..." with regard to programs certainly leaves a lot of
room for bullshit. Also note, that one could posit the following:
given a program in an interpreted language, A, and its interpreter, B,
which when executing A will produce a series of instructions, C, it is
practically possible to duplicate the semantics of program A ran on
interpreter B by executing the series C and that alone - I am not
trying to advocate this position (at first sight it looks a little
problematic too, but I haven't had coffee yet), but I could see how
someone would say that A "has become" C.
 
N

Nick Keighley

On 02/01/2010 06:14 AM, Nobody wrote:
On Sun, 31 Jan 2010 20:40:26 +1100, Borax Man wrote:
All code in all languages end up as machine code in the end.
Consider an interpreter [...] Just because in order to complete the
execution you require the machine code of the interpreter does not
mean that the source programs have become machine code.

You use an interesting expression; "...have become...". What does it
mean exactly, for a program to "become" something else? Is it
transformed by means of its own workings? Is it manipulated by forces
beyond its limited rules of comprehension; the Programmer, or the
Compiler, or the Interpreter? Surely, for the Interpreter to transmute
the Programmer's word into actions, certain "machine code" has to be
executed, does it not? One could say, with much certainty, that the
original program has "become" a much different series of instructions,
mandated now not only by the Programmer, but also the Interpreter (or
Virtual Machine, or whatever we decide to call It, at this point), and
they would be right, because the loose definition of the expression
"...have become..." with regard to programs certainly leaves a lot of
room for bullshit. Also note, that one could posit the following:
given a program in an interpreted language, A, and its interpreter, B,
which when executing A will produce a series of instructions, C, it is
practically possible to duplicate the semantics of program A ran on
interpreter B by executing the series C and that alone - I am not
trying to advocate this position (at first sight it looks a little
problematic too, but I haven't had coffee yet), but I could see how
someone would say that A "has become" C.[/QUOTE]


what if I never compile or interpret the program but "execute" it
using pencil and paper?
What about the code i never compile, does that end up as machine code?
 
M

Michael Foukarakis

On 02/01/2010 06:14 AM, Nobody wrote:
On Sun, 31 Jan 2010 20:40:26 +1100, Borax Man wrote:
All code in all languages end up as machine code in the end.
Consider an interpreter [...] Just because in order to complete the
execution you require the machine code of the interpreter does not
mean that the source programs have become machine code.
You use an interesting expression; "...have become...". What does it
mean exactly, for a program to "become" something else? Is it
transformed by means of its own workings? Is it manipulated by forces
beyond its limited rules of comprehension; the Programmer, or the
Compiler, or the Interpreter? Surely, for the Interpreter to transmute
the Programmer's word into actions, certain "machine code" has to be
executed, does it not? One could say, with much certainty, that the
original program has "become" a much different series of instructions,
mandated now not only by the Programmer, but also the Interpreter (or
Virtual Machine, or whatever we decide to call It, at this point), and
they would be right, because the loose definition of the expression
"...have become..." with regard to programs certainly leaves a lot of
room for bullshit. Also note, that one could posit the following:
given a program in an interpreted language, A, and its interpreter, B,
which when executing A will produce a series of instructions, C, it is
practically possible to duplicate the semantics of program A ran on
interpreter B by executing the series C and that alone - I am not
trying to advocate this position (at first sight it looks a little
problematic too, but I haven't had coffee yet), but I could see how
someone would say that A "has become" C.

what if I never compile or interpret the program but "execute" it
using pencil and paper?
What about the code i never compile, does that end up as machine code?

Obviously not; what is your point?

Sidenote: I thought this discussion involved computers, not pencils or
drums (revolving or whatnot). As I said, I won't advocate the
aforementioned statement, but it seems rather childish of you to
invoke reductio ad absurdum when it's obvious that Man is referring to
the process of writing, compiling, and executing code on a computer,
or at least similar constructs.. (embedded devices blah blah blah)
 
L

ld

On Feb 2, 12:47 am, Phil Carmody <[email protected]>
On 02/01/2010 06:14 AM, Nobody wrote:
On Sun, 31 Jan 2010 20:40:26 +1100, Borax Man wrote:
All code in all languages end up as machine code in the end.
Consider an interpreter [...] Just because in order to complete the
execution you require the machine code of the interpreter does not
mean that the source programs have become machine code.
You use an interesting expression; "...have become...". What does it
mean exactly, for a program to "become" something else? Is it
transformed by means of its own workings? Is it manipulated by forces
beyond its limited rules of comprehension; the Programmer, or the
Compiler, or the Interpreter? Surely, for the Interpreter to transmute
the Programmer's word into actions, certain "machine code" has to be
executed, does it not? One could say, with much certainty, that the
original program has "become" a much different series of instructions,
mandated now not only by the Programmer, but also the Interpreter (or
Virtual Machine, or whatever we decide to call It, at this point), and
they would be right, because the loose definition of the expression
"...have become..." with regard to programs certainly leaves a lot of
room for bullshit. Also note, that one could posit the following:
given a program in an interpreted language, A, and its interpreter, B,
which when executing A will produce a series of instructions, C, it is
practically possible to duplicate the semantics of program A ran on
interpreter B by executing the series C and that alone - I am not
trying to advocate this position (at first sight it looks a little
problematic too, but I haven't had coffee yet), but I could see how
someone would say that A "has become" C.
what if I never compile or interpret the program but "execute" it
using pencil and paper?
What about the code i never compile, does that end up as machine code?

Obviously not; what is your point?

Sidenote: I thought this discussion involved computers, not pencils or
drums (revolving or whatnot). As I said, I won't advocate the
aforementioned statement, but it seems rather childish of you to
invoke reductio ad absurdum when it's obvious that Man is referring to
the process of writing, compiling, and executing code on a computer,
or at least similar constructs.. (embedded devices blah blah blah)

The following program:

---
#include <cos/cpp/hanoi.h>

COS_PP_HANOI(10)
---
where hanoi.h can be taken there
http://cos.cvs.sourceforge.net/viewvc/cos/CosBase/include/cos/cpp/hanoi.h?view=markup

running
gcc -std=c99 -I. -E hanoi.c

will display the moves solution of the Hanoi Tower for 10 disks. No
compilation, no byte code, just an interpreter (cpp) and a result
displayed ;-) Meta programming (which is code!) does not necessarily
ends in machine code, part of the code is just there to provide
constraints, ensure correctness, make sanity checks, make compile-time
computation, ... and vanish after the compilation phases.

regards,

ld.
 
M

Michael Foukarakis

On Feb 2, 11:38 am, Nick Keighley <[email protected]>
wrote:
On Feb 2, 12:47 am, Phil Carmody <[email protected]>
On 02/01/2010 06:14 AM, Nobody wrote:
On Sun, 31 Jan 2010 20:40:26 +1100, Borax Man wrote:
All code in all languages end up as machine code in the end.
Consider an interpreter [...] Just because in order to complete the
execution you require the machine code of the interpreter does not
mean that the source programs have become machine code.
You use an interesting expression; "...have become...". What does it
mean exactly, for a program to "become" something else? Is it
transformed by means of its own workings? Is it manipulated by forces
beyond its limited rules of comprehension; the Programmer, or the
Compiler, or the Interpreter? Surely, for the Interpreter to transmute
the Programmer's word into actions, certain "machine code" has to be
executed, does it not? One could say, with much certainty, that the
original program has "become" a much different series of instructions,
mandated now not only by the Programmer, but also the Interpreter (or
Virtual Machine, or whatever we decide to call It, at this point), and
they would be right, because the loose definition of the expression
"...have become..." with regard to programs certainly leaves a lot of
room for bullshit. Also note, that one could posit the following:
given a program in an interpreted language, A, and its interpreter, B,
which when executing A will produce a series of instructions, C, it is
practically possible to duplicate the semantics of program A ran on
interpreter B by executing the series C and that alone - I am not
trying to advocate this position (at first sight it looks a little
problematic too, but I haven't had coffee yet), but I could see how
someone would say that A "has become" C.
what if I never compile or interpret the program but "execute" it
using pencil and paper?
What about the code i never compile, does that end up as machine code?
Obviously not; what is your point?
Sidenote: I thought this discussion involved computers, not pencils or
drums (revolving or whatnot). As I said, I won't advocate the
aforementioned statement, but it seems rather childish of you to
invoke reductio ad absurdum when it's obvious that Man is referring to
the process of writing, compiling, and executing code on a computer,
or at least similar constructs.. (embedded devices blah blah blah)

The following program:

---
#include <cos/cpp/hanoi.h>

COS_PP_HANOI(10)
---
where hanoi.h can be taken therehttp://cos.cvs.sourceforge.net/viewvc/cos/CosBase/include/cos/cpp/han...

running
gcc -std=c99 -I. -E hanoi.c

will display the moves solution of the Hanoi Tower for 10 disks. No
compilation, no byte code, just an interpreter (cpp) and a result
displayed ;-)

Maybe you missed the part where I wrote this: "Surely, for the
Interpreter to transmute
the Programmer's word into actions, certain "machine code" has to be
executed, does it not?". In this case, cpp's code which will
interpret, evaluate, optimize, etc. the above program. Correct? Didn't
your program cause the execution of (some) code? Sure, the code you
wrote "COS_PP_HANOI(10)" didn't appear anywhere, in any directly
observable form. But you saw results. What caused those? Magic?
Meta programming (which is code!) does not necessarily
ends in machine code, part of the code is just there to provide
constraints, ensure correctness, make sanity checks, make compile-time
computation, ... and vanish after the compilation phases.

OK, right now I'm actually led to think you guys are being
intentionally dense just to mock me, so I'll stop.
 
B

bartc

Nick said:
I'm with others who don't really agree with this for interpreted code.
Sure, all code leads to machine code being executed, but does that
really mean anything of any importance? After all, it all ends up as
micro code and as values on pins on ICs.

That's a good point. Even if two programs consist of different machine code,
the processor machinery that executes them will be the same. This seems to
be the case at any level, where different programs are just different
bunches of data for the 'hardware' that operates on them:

'Program': 'Data':

application user-input
interpreter bytecode (etc)
processor machine-code
register-transfer-logic microcode

And of course pretty much any HLL can emulate the workings of hardware (just
to confuse matters a little)

What about LISP machines?

Apart from LISP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,241
Latest member
Lisa1997

Latest Threads

Top