I wrote a Brainfuck to Go compiler
kabirgoel.com
I wrote a Brainfuck to Go compiler
1–10 of 23 posts
Re: I wrote a Brainfuck to Go compiler
#2Re: I wrote a Brainfuck to Go compiler
#3I might be wrong, but is this not a transpiler instead of a compiler?
The textbook definition of a compiler from A to B is any program that takes as input a program PA written in A and gives as output a program PB written in B, such that for all valid inputs I and modulo the undefined behaviors of A and B, it holds that PA(I) = PB(I).
So you could write a Java program that turns C++ into Python and it would technically qualify as a compiler.
Re: I wrote a Brainfuck to Go compiler
#4I might be wrong, but is this not a transpiler instead of a compiler?
Re: I wrote a Brainfuck to Go compiler
#5(If you are genuinely curious, there is already a BASIC-to-Brainfuck compiler [1] and a C-to-Brainfuck compiler [2].)
[1] https://esolangs.org/wiki/BFBASIC
[2] https://esolangs.org/wiki/C2BF (and I think I've seen at least two more)
Re: I wrote a Brainfuck to Go compiler
#6I might be wrong, but is this not a transpiler instead of a compiler?
Neither the source nor the target language are JS, the project isn't webdev-adjacent, and the author isn't trying to make up a cool-sounding title for an early-computing magazine, so I'm not sure why it would be!
Transpilers aren't limited to JS nor web dev. There are various other transpilers/compilers such as nimlangs compiler that can target C.
Re: I wrote a Brainfuck to Go compiler
#7Earlier quoted context omitted.
Neither the source nor the target language are JS, the project isn't webdev-adjacent, and the author isn't trying to make up a cool-sounding title for an early-computing magazine, so I'm not sure why it would be!
A transpiler is just a piece of software that translates code to code. A compiler is a transpiler that targets machine code and usually builds an executable through various pipelines, e.g. optimization passes etc. Transpilers aren't limited to JS nor web dev. There are various other transpilers/compilers such as nimlangs compiler that can target C.
(Parts of the Nim community are famously insistent that they have a compiler, not a transpiler!)
Re: I wrote a Brainfuck to Go compiler
#8I might be wrong, but is this not a transpiler instead of a compiler?
Re: I wrote a Brainfuck to Go compiler
#9I might be wrong, but is this not a transpiler instead of a compiler?
Back in University, I had a Programming Languages professor who spent an entire lecture ranting about the term transpiler and how ridiculous he thought it was. Although I never shared his distaste for the term to the same degree, I anyways felt somewhat kindred with him on it. It's a useful term if you want to draw a distinction (for whatever reason), between moving from a human-readable language to a computer-readab…
I don't know if there's any actual good distinction to draw that won't have problems. I'd be interested to listen to people theorize on what the distinction is.
Re: I wrote a Brainfuck to Go compiler
#10Meanwhile, a Go to Brainfuck compiler remains uncharted territory. (If you are genuinely curious, there is already a BASIC-to-Brainfuck compiler [1] and a C-to-Brainfuck compiler [2].) [1] https://esolangs.org/wiki/BFBASIC [2] https://esolangs.org/wiki/C2BF (and I think I've seen at least two more)
Not at all... Just compile your Go code to WebAssembly [1], then to C [2], and finally to BF [3].
[1] https://binx.io/2022/04/22/golang-webassembly/