7 ms·
Is it correct to say Borgo "compiles to Go", or should it say "transpiles to Go" It appears to be a transpiler (consumes a Borgo and does the work to convert a
by metadat 3y ago
Is it correct to say Borgo "compiles to Go", or should it say "transpiles to Go"
It appears to be a transpiler (consumes a Borgo and does the work to convert and emit a Go program as text):
https://github.com/borgo-lang/borgo/blob/main/compiler/src/codegen.rs https://github.com/borgo-lang/borgo/blob/main/compiler/src/c...
- PurpleRamen 3y agoReadme says transpile: "Borgo is a new language that transpiles to Go." And it's written in rust. Kinda unholy.
- metadat 3y agoYeah, the top of the project says "compiles", then the readme says "transpiles". Perhaps the author was just trying to get all the SEO terms in there. > And it's written in rust. Kinda unholy. Agreed, it's like, do you really hate writing Go so much that you'll really write all that Rust to get out of it? Haha. Reminds me of the web frameworks which generated the JS so you didn't have to touch it, like GWT of old. I'm sure it was a fun exercise to create Borgo, though. My favorite transpiler is Haxe. It targets so many other languages, the surface area is impressive. https://haxe.org/ https://haxe.org/
- Alifatisk 3y agoI’ve totally forgotten about Haxe!
- pjmlp 3y agoNothing like adding dependencies to the build toolchain.
- speed_spread 3y agoNothing unholy there. It's easier to transpile to a less constrained language. Transpiling to Rust would require using one of the GC crates or refcount everything. Then you'd have to also satisfy the mutability and send/sync constraints. Go needs none of these things, so all the transpiler needs to care about is it's own added constraints.
- frozenport 3y agoTranspiler is a kind of compiler
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- michaelsbradley 3y ago“transpiler”, “compiler”, either terminology is valid: https://en.wikipedia.org/wiki/Source-to-source_compiler https://en.wikipedia.org/wiki/Source-to-source_compiler
- metadat 3y agoThanks, I'd always thought targeted transformations -> transpiler, but it makes sense it's really a subset of general compiler functionality, sans binary output.
- randomdata 3y ago> but it makes sense it's really a subset of general compiler functionality, sans binary output. Tell us more about this compiler subset that does not produce binary output. What do they produce? Ternary? Qubits? Nothing?
- lolinder 3y agoThey produce text, such as Golang source code.
- randomdata 3y agoThanks for your response, but the Go spec asserts that Go source is represented as UTF-8. UTF-8 is a binary encoding. We're talking about compilers that produce something other than binary output.
- lolinder 3y agoAh, my mistake, I thought you were making an earnest inquiry and not a joke. Carry on.
- jerf 3y agoThe word "transpiler" propagates the misunderstanding that there is something special about a compiler that emits machine code, that requires some special "compiler" techniques for special "compiler" purposes that are not necessary for "transpiler" purposes because "transpiling" requires a completely different set of techniques. There aren't any such techniques. If one were to create an academic discipline to study "transpilers" and one to study "compilers", all you'd end up with is an identical bunch of techniques and analyses with different names on them. (A thing that sometimes happens when diverse disciplines study what turns out to be the same thing; see machine learning versus statistics for a well-known example.) Even "compiling" to machine code isn't special anymore, because CPUs don't actually execute assembly anymore. They themselves compile assembly into internal micro-ops, which is what they actually execute. So compilers don't even compile "machine language" anymore; it's just another target. This also dodges "is it a 'compiler' or a 'transpiler' if it targets WASM?", which is good, because there is no value in that question on any level.
- markusde 3y agoIt doesn't matter but I fully disagree with this. A transpiler emits code the user is supposed to understand, a compiler does not. At least that's the general way I've seen the term used, and it seems quite consistent.
- eklavya 3y agoI see what you mean but how is it academically useful to identify transpilers something of their own? It's still compiling (lowering) from one notation to another.
- randomdata 3y agoAll compiler outputs are understandable. I suppose you mean with the intent of it being a one-time translation? As in, like when the Go project converted the original C codebase into Go source with the intent of having developers work in the Go output afterwards and the C code to be never touched again? What is meaningful about such a distinction?
- 3y ago