Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can Assembly be considered a programming language? Isn't is just a language for... assembling?


One might say it is the only programming language, everything else is just macro expansion, converting pseudo-english mnemonics into machine instruction.

Snark aside, yes, people program entire operating systems and programs and games in assembly. Famously, Rollercoaster Tycoon was written entirely in assembly.


This is true only for the most simple assemblers. In practice, each assembler comes with its own distinct set of features.

Microsoft Macro Assembler for example offers:

• Records/structs, bitfields

• Typed labels/pointers. Intel in particular introduced this feature.

• Procedure blocks which allow locally scoped labels within them

• The automatic allocation of local variables onto the stack.

• if/then blocks, for loop blocks

• Memory model directives

• Macros, equates, etc.

Other assemblers like NASM omit some of these features, as introducing versions of these features which are completely compatible with the MASM ones would be difficult. For example, NASM allows MASM-like procedure blocks, but they are not block-scoped. They're just a notation for the programmer.


Yes, certainly Assembly is a programming language. If you could not express your program in it, all of our discipline would fall (if a script defined a process and what it translates to did not...). "Things work" because /other/ languages translate into it: that is the chief language, named ("symbolic") reading of machine code. It has conditionals and loops, it has logic and arithmetic operators, it has "exactly" what the processor has: it is the most precise definition of the program, how can it not be a programming language?

You are probably thinking of the assembling process of pieces of machine code - through the assembler. But the assembler also translates symbolics into machine code, in the goal to join the different pieces of code and data - so it's more than just concatenating. To define the memory addresses to be encoded for jumps, for example, you must have defined them - so, in the assembler (e.g. concatenating subroutines) you imply the assembly (i.e. naming pieces of machine code, symbolically treated).


Most assemblers have macros and other directives that give you some level of higher-order control than just writing machine code.


assuming you have enough registers, burn a small number of them to support internal use in macros. assign the rest to values of interest. you may end up needing to write an additional layer of macros with their own registers that use the first layer as primitives.

now you're essentially programming in basic


Sure. It's less abstracted than anything except for machine code but that doesn't make it not a language.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: