Hacker News new | comments | ask | show | jobs | submit login

Machine code is just source code for a cpu.

Anyways, how is a transpiler different from a bytecode compiler, except that the bytecode is human readable?

> how is a transpiler different from a bytecode compiler, except that the bytecode is human readable?

The bytecode is human readable.

The assembly that comes out of GCC is human readable too (the actual assembling occurs via a different program from a different project than GCC). Is GCC a transpiler?

No, because assembly is not approximately the same level of abstraction as C.

How do you define that in a way that isn't a tautology?

"I'll know it when I see it"

I'm not going to waste any more time defining things for you. Suffice to say, Go and JavaScript are roughly the same level of abstraction.

You haven't really defined anything though. Your joke is kind of to my point.

Not sure if trolling. I think most programmers have a sense of what constitutes "roughly the same level of abstraction". Certainly there are gray areas, but such is life.

I've been mainly asking, how does the compiler intrinsically change depending on the abstraction of it's source and target?

In my mind your argument is equivalent to to separating novels based on if they were written with a pen or a pencil. Yes, there's a difference between a pen and a pencil, but that has no effective bearing on the novel as written. And it doesn't make sense to categorize novels based on that.

Back around 1985, I got involved in a discussion on BIX with Bjarne Stroustrup about whether Cfront was a compiler or not.

Cfront was Bjarne's original C++ compiler. It translated C++ code into C code which would then be passed through a C compiler.

I didn't think Cfront should be called a compiler, because it didn't compile down to machine code and not even to assembly, only to another relatively high level language.

Bjarne was quite insistent that Cfront really was a compiler, and the fact that it compiled to another source language was immaterial. It did essentially the same things as any compiler, it only had a different back end code generator. And the code generator could later be swapped out for one that generates machine code.

Of course you can call it whatever you want, but Bjarne called it a compiler.

My position* is transpilers are a subset of compilers. So yes, Cfront was a compiler, and a transpiler.

* Which I admittedly didn't make clear in the parent comments, but did mention elsewhere in this thread.

Ah, it sounds like we are on the same page after all. I mistook what you said for something I've occasionally seen other people say, that a transpiler is not a compiler. My apology for the misunderstanding.

Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact