Would it be necessary to have another programming language to create the assembler?

10

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

I know that according to the years, just after the punched cards, came the assembly language. But, has the Assembly programming language and its Assembler compiler been programmed with another programming language? If so, what would it be?

    
asked by anonymous 22.05.2017 / 06:38

3 answers

14

There are wrong assumptions in the question. Assembly exists prior to the punched cards which is actually just a data entry. Assembler is not a compiler, although some people think so. It's even a compiler way, but it's not complete, so it's just considered an assembler.

You have questions that help you better understand this and the first programming language:

Machine language is the binary code that the machine understands. It may even be written off the machine, but it is rare for anyone to do it. It does not need to be transformed.

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

The assembler is an assembly translation mechanism for machine code, so it is software. So it needs to be developed in some language. The first one was certainly written in machine code. Henceforth 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 answering the question strictly, yes, nowadays it is possible to write an assembler with any programming language. In the 1940s it was necessary to use machine language.

Assembly is a programming language, so it is only a specification .

Program binary here .

    
22.05.2017 / 14:55
2

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 own commands. Here's a link to the z80 processor opcodes, a good processor to learn: Opcodes z80

A compiler actually transforms 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 equivalent, more or less to x = y + z;

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

I hope you have answered your question clearly.

    
22.05.2017 / 07:31
0

If you were just creating a new processor and had no other machine available, you would have to write the first assembler for it in direct machine code on a disk, tape, cards, or even memory. And probably, this assembler would have the minimum resources needed for you to write an upcoming version with more assembly features or a higher level language.

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

    
22.05.2017 / 15:20