4 ms·
Honest question - is there any language at all between C and Assembly? Because if there is, I haven't heard of it. For that reason alone, my mental model has al
by danielvaughn 3y ago
Honest question - is there any language at all between C and Assembly? Because if there is, I haven't heard of it. For that reason alone, my mental model has always been "C is the lowest you can go before hitting direct instructions to the processor."
- lebuffon 3y agoI would say Forth is lower level than C. The mental model is a two stack machine plus memory, rather than a PDP-11. And it is very reasonable if you are under 50 years of age, that you haven't heard of it.
- jeffreygoesto 3y agoStarted programming 81 and technically I could have known it https://www.timexsinclair.com/product/zx-forth/ https://www.timexsinclair.com/product/zx-forth/
- xigoi 3y ago> is there any language at all between C and Assembly? LLVM or QBE, for example.
- fiedzia 3y agoConceptually, you can consider LLVM IR to be such language, and there are people who use it that way.
- grotorea 3y agoThere are some cleverer assemblers that allow to program in assembly while still being able to do stuff like loops without too much effort https://en.wikipedia.org/wiki/Assembly_language#Support_for_structured_programming https://en.wikipedia.org/wiki/Assembly_language#Support_for_...
- CJefferson 3y agoC makes lots of things undefined behavior which are perfectly fine in assembler — read a stack without first writing to it, doing overflow signed internet arithmetic, treating the same memory location as different types. Also there is quite a lot in modern assembler that you can’t really get to from C, like prefetch and cache flushing instructions.
- danielvaughn 3y agoThat last bit is really interesting. Do newer languages make use of those features? Sorry I’m fairly ignorant of this level of the stack.
- trealira 3y agoNewer languages don't make use of any of those features, to my knowledge. They're only available in assembly, and only on modern processors. Because C was made on and designed for hardware that was crappy even in the 1970s, which didn't have a cache or do out of order execution, C doesn't fully reflect the capabilities of modern processors. That's what they're implying with the last sentence, I'm pretty sure.
- titzer 3y agoYes, WebAssembly is higher-level than machine code but lower than C.
- trealira 3y agoWhile staying portable across architectures, probably not. But you can make a little language that's nicer to jse than assembly for a particular CPU. COMFY-65 is a compiler for a small Lisp language that provides all non-branching operations of the 6502 processor as primitives (e.g. tests for carries, overflows, zero, and negative; set decimal arithmetic mode; etc.). However, programs still consist of subroutines, loops, and tests, with no "go to label" construct provided. It's surprisingly simple and, I would say, elegant. Here's the PDF that outlines it: https://dl.acm.org/doi/pdf/10.1145/270941.270947 https://dl.acm.org/doi/pdf/10.1145/270941.270947