lots of good stuff in the /r/lisp discussion
Can we call it what it is: a compiler. The term “transpiler” has come into vogue lately, and has a history dating back to the 80s. The problem is that it offers no benefit in use over the word “compiler,” which of course means: “transforms source code written in a programming language into another computer language.”
The amount of jargon in computing is already so numerous that the distinction of “at about the same abstraction level” that transpiler utilizes isn’t helpful to new programmers, and is actually a hinderance, in my opinion.
Regarding this project, it seems really nice! I’ve seen many attempts to build systems programming languages (using close to the metal for the definition of sysprog) using s-expressions as the syntax, but don’t recall ever seeing a skin for C like this!
if a compiler that goes from language A to language B is a transpiler, is a compiler that goes from a language back to itself (performing some transformation) a cispiler? enquiring minds wish to know
If you really want to introduce the term “cispiler”, come up with something that takes language A as input and outputs language A.
come up with something that takes language A as input and outputs language A.
That’s exactly what she said:
a compiler that goes from a language back to itself
Like a pretty-printer for an IDE! These things exist.
Formatting is not really a significant transformation. “Gofix” does some actual rewriting, but it can be argued that it takes an older version of the language and outputs the newer one.
We call “compiler” the software that outputs assembly and “transpiler” the one that outputs some other programming language (that may be compiled to assembly in another stage). Sometimes the distinction is important.
I’m well aware of the distinction. I just don’t think it’s necessary.
I’ll assume you know of Yacc. Did you know it’s actually an acronym for “Yet Another Compiler Compiler”? The history of “compiler compilers” is interesting, and tools that aren’t just parser generators exist and create full blown interpreters and other compilers form a descriptive language. These don’t, typically, generate assembly code, but are called compilers. Therefore, I reject your definition of compiler.
So if we want to use fewer words, we can say that TypeScript is transpiled and Rust is compiled and be sure that everybody understands the difference.
A typical compiler, by itself, does nothing but rerepresent some source code as something else, which some other tool can do something else with.
[Comment from banned user removed]
I am not confused. “Some sort of object code” just wasn’t clear to you.
For all intents and purposes, the assembly code is the same as “object code,” since the assembler typically just translates human readable strings into a series of packed, fixed size numbers. It, of course, does a bit more than that.
Some LLVM based language compilers are even more fun. They don’t even produce assembly directly! Instead, they output a new intermediate representation, which is human readable, which the LLVM tooling can optimize and compile into assembly, which gets assembled, which can then get linked…
So, are LLVM based languages actually “transpilers” to you? And, are you starting to see why I think this word is superfluous?
For all intents and purposes, the assembly code is the same as “object code,”
No, of course not. See the links I provided. For an overview of how an assembler is not simply replacing strings with opcodes, see https://sourceware.org/binutils/docs/as/
So, are LLVM based languages actually “transpilers” to you?
Let’s look at rustc. It does transpilation to LLVM IR in phase_4_translate_to_llvm() and it invokes LLVM to compile it to Assembly, then LLVM’s assembler to assemble the output into machine code - all that in phase_5_run_llvm_passes().
So rustc is mostly a transpiler that relies on LLVM for the actual compilation (and assembly). Rust is first transpiled to IR, then the IR compiled. Since the transpilation is just an internal intermediary phase, we can consider Rust a compiled language in the reference implementation.
And, are you starting to see why I think this word is superfluous?
No, the distinction between interpreting Python’s bytecode and running Go’s machine code is very important in practice.
You seem to think I’m some kind of idiot, and I don’t appreciate it. So, rather than me becoming enraged, and resulting to name calling, we’ll just have to agree to disagree.
It does transpilation to LLVM IR in phase4translatetollvm() and it invokes LLVM to compile it to Assembly …
And, if we rewrite that as “It does compilation to LLVM IR in phase4translatetollvm…” it’s still just as easy to understand. But, I digress, and will not continue to comment on this thread. (Agreeing to disagree and all)
(Also, I am your downvote.)
C compiler produces Assembly.
This isn’t definitively true, and IIRC the Microsoft compilers can generate assembly, but produce already “assembled”, e.g. object, code by default.
Then a transpiler can be a subset of compiler where either term is correct but transpiler is used when distinction is really important. Most people just want to input X to get Y out the other end.
Then a transpiler can be a subset of compiler
It might make more sense the other way around: a compiler is a particular type of transpiler.
It could go either way. Compiler is the oldest term. Might factor in.
Transpilation is often considered a compilation strategy, like ahead of time or just-in-time compilation.
LOL. You’ve obviously never read Reynolds, Jones, and Blowhard’s amazing work.
I agree with you. Called mime a source-to-source compiler on Hacker News with a compiler dev correcting me that what I described was a “transpiler” but admitting they do “essentially the same thing” in same comment. Begs the obvious question about why he’d bother to correct me…
He did it because like a lot of people (myself included) in this industry, he’s a blowhard.
This is exactly the kind of thing I had in mind in the Scheme/LISP section of my counterpoint to C++’s complexity:
It’s also similar to what I did for a BASIC-like 4GL. Creating constructs that allow for easy program analysis or transformation makes many features in high-level languages much easier to do than trying to fit them in C’s own syntax or semantics. Better to use something easier to work with that extracts to C. “Right tool for the job” and so on.
reminds me of this classic story [link to postscript file, couldn’t find it on a webpage]
I really want something like this for Haskell. S-expressions make too much sense not to use, especially if you configure your keyboard to insert parentheses when you tap shift.