Skip to main content
15 events
when toggle format what by license comment
Sep 9, 2015 at 10:42 comment added PJTraill @MichaelKjörling: You are quite right. I was thinking of bootstrapping the compiler and forgetting all about cross-compilers! By ‘maintainable’ I only meant ‘more maintainable than binary’ rather than ‘more maintainable than a high-level language’, which is of course absurd!
Sep 8, 2015 at 19:36 comment added user @PJTraill There is no reason whatsoever to write a compiler in assembler on a modern system, except for the very first bootstrapping step (and most of the time, not even then). Compilers written in a high-level language are vastly more likely to actually be maintainable. Also compare How can a language whose compiler is written in C ever be faster than C?. The purpose of a compiler is to translate from one language (the source language) to another (usually machine language for a specific architecture and OS); this can be written in any language.
Sep 8, 2015 at 10:41 comment added Aron @slebetman or JavaByte code or x86
Sep 8, 2015 at 10:39 comment added Aron An interesting point is that the basic difference in philosophies between RISC and CISC is that the "assembly" in RISC machines is low level instructions, whilst CISC processors need to translate each assembly instruction into its own processor instruction.
Sep 8, 2015 at 8:45 comment added PJTraill Another reason to use assembler is, of course, to produce a maintainable compiler (or back-end), preferably exploiting the instruction set well.
Sep 8, 2015 at 5:52 comment added slebetman @nTuply: Modifying the assembly of modern CPUs so that they can work with other CPUs will end up with a language that looks like C or BASIC (more like BASIC, no, not Visual BASIC, the original BASIC). They are languagges that evolve out of assembly and macro processors and their programming paradigm is the same as assembly. On the other hand, dreaming up an assembly language for a CPU that doesn't exist that can later be translated to other real-world CPUs will give you something like Forth or Lisp (or a Turing Machine)
S Sep 7, 2015 at 23:41 history suggested svick CC BY-SA 3.0
link formatting
Sep 7, 2015 at 21:41 review Suggested edits
S Sep 7, 2015 at 23:41
Sep 7, 2015 at 20:39 comment added Paul Draper @nTuply, that exists. The process of going from that extra-assembly language to machine instructions is called compilation.
Sep 7, 2015 at 19:10 comment added Steve Jessop It's not a completely stupid idea to have an "assembly language" that is translated for different machines, because that's basically what LLVM's "IR" is. However, for the reasons David gives, you don't normally write LLVM assembly. Also because 99 times out of 100 you'd do a worse job of writing it than clang does of translating your C to LLVM. Assembly languages are potentially more efficient than high-level languages, but in the hands of most actual programmers with a typical amount of time available to optimise, they don't reach their potential anyway.
Sep 7, 2015 at 18:01 comment added David Richerby @nTuply As soon as you modify your assembly language to cater for different machines, it's become a high-level language with horribly assembly-style syntax. Once you've decided to use a high-level language, you may as well use one with friendlier syntax and let the compiler do the hard work.
Sep 7, 2015 at 17:20 vote accept nTuply
Sep 7, 2015 at 17:17 comment added D.W. I think that question is already answered by the 3rd paragraph of my answer. As you said, such a scheme would not be efficient, so it'd be fundamentally at odds with the core reason to use assembly language.
Sep 7, 2015 at 17:10 comment added nTuply Okay, this may sound crazy but I will ask it anyways. Would it be actually possible to modify the Assembly language to cater for different machines, like maybe checks the hardware and generates the code based on that? This would probably make it virtually impossible since there are tons of different architectures that exist and it would not be efficient then. I know this is extremely far-fetched but would still like to hear an answer for that.
Sep 7, 2015 at 16:58 history answered D.W. CC BY-SA 3.0