What is the main difference between a Compiler and a Transpiler?

They’re essentially the same: take source code and transform it to something else. The difference is that compiler usually produces a directly usable artifact (executable binary of some sort). Example: C (produces binary), C# (produces bytecode). Whereas transpiler produces another form of source code (in another language, for example), which is not directly runnable and … Read more

How to compile Lua scripts into a single executable, while still gaining the fast LuaJIT compiler?

Translate all of the Lua source code files to object files and put them in a static library: for f in *.lua; do luajit -b $f `basename $f .lua`.o done ar rcus libmyluafiles.a *.o Then link the libmyluafiles.a library into your main program using -Wl,–whole-archive -lmyluafiles -Wl,–no-whole-archive -Wl,-E. This line forces the linker to include … Read more

Difference between compiled and interpreted languages?

Neither approach has a clear advantage over the other – if one approach was always better, chances are that we’d start using it everywhere! Generally speaking, compilers offer the following advantages: Because they can see all the code up-front, they can perform a number of analyses and optimizations when generating code that makes the final … Read more

What does the compile-time error “Undefined symbols for architecture x86_64” mean?

When you compile the file, the compiler invokes the linker which tries to generate an executable. But it cannot because you didn’t provide a function named main which is the function that will be executed when your program is launched. Either you don’t want to run the linker because you want to compile several files … Read more

Are functional languages inherently slow? [closed]

Are functional languages inherently slow? In some sense, yes. They require infrastructure that inevitably adds overheads over what can theoretically be attained using assembler by hand. In particular, first-class lexical closures only work well with garbage collection because they allow values to be carried out of scope. Why are functional languages always tailing behind C … Read more

what is cross compilation?

Cross-compilation is the act of compiling code for one computer system (often known as the target) on a different system, called the host. It’s a very useful technique, for instance when the target system is too small to host the compiler and all relevant files. Common examples include many embedded systems, but also typical game … Read more