Would you need to have another programming language to create assembler?

Would you need to have another programming language to create assembler? If so, which one? If not, what could you do to get started?

I know that over the years, just after the punched cards, the assembly language emerged. But, was the assembly programming language and its Assembler compiler also programmed with another programming language? If so, what would it be?

Author: Maniero, 2017-05-22

3 answers

There are wrong assumptions in the question. Assembly (emphasis on capital) exists before punched cards which is actually just a data entry. Assembler is not a compiler, although some people think so. It is even a form of compiler, but it is not complete, so it is considered only an assembler, as the name says.

Has questions that help you better understand this and about the first programming language:

The machine language is the binary code that the machine understands. It can even be written off the machine, but it is rare who does. It does not need to be transformed.

O Assembly is a text" understandable " by humans. The Assembly exists outside the machine, after input on the computer needs a transformation, by assembler. There is a 1-to-1 relationship between Assembly code and machine code.

Assembler is a translation engine from Assembly to machine code, so it is software. Therefore, it needs to be developed in some language. The first was certainly written in machine code. From then on it was possible, but not necessarily done so, this and other assemblers were used to write any kind of software, including compilers and other assemblers. Today it is possible to use a high-level language to write an assembler.

So strictly answering the question asked, yes, nowadays it is possible to write an assembler with any programming language. In the 40s it was necessary to use machine language.

Assembly is a language of programming, so it's just a specification.

Program binary here .

 15
Author: Maniero, 2020-05-19 17:56:52

Luana, a compiled program are codes in format supported by the processor architecture - intel processors for example follow the CISC architecture-each architecture has a set of commands of its own. Following is a link with the Z80 processor opcodes, a good processor to learn: z80 opcodes

A compiler actually turns its lines of code into a series of equivalent opcodes. The assembly is the opcodes themselves, for example:

ld a, #1800  //Carrega o valor na posição de memória #1800 para o registrador a
adc a, #1802 //Soma o valor em a com o valor na posição #1802
ld #1804, a  // Grava o valor de a na posição #1804 da memória

This would be roughly equivalent to x = y + z;

The Assembler would only then be responsible for turning this into binary.

I hope you answered your question clearly.

 2
Author: Leonardo Moura, 2017-05-22 05:31:02

If you were now creating a new processor and had no other machine available, you would have to write the first assembler for it in machine code straight to a disk, tape, cards, or even memory. And probably, this assembler would have the minimum of resources necessary for you to be able to write a next version with more resources in assembly or in a higher level language.

As nowadays we have several languages of all levels you you can choose the language that is most appropriate to generate the assembler, and C is usually the first best option.

 0
Author: Gustavo Jantsch, 2017-05-22 13:39:28