Compiler: translation to assembly

I wrote an interpreter for my experimental language and I know that I want to move on and write a small compiler for it. This will probably take the source code, follow the same steps as the interpreter (tokenizer, parser), and then transfer the source to the assembly.

Now my questions are:

  • Is it possible to expect that every command in my language can be translated in 1: 1 on a bunch of assembly instructions? I mean, if I have to completely quit the entire input program, or if it is simply transferred to an assembly in a line.

  • Which assembler should be used as the output format?

+3
source share
3 answers
  • , ASM . : , . , , , 1:1, . , ( ).
  • . Windows, x86 .
+3

" ", C, C, . . , , C ..

0

No, you cannot expect this. If your language contains things like eval (), it can get scared.

As a basic assembler, nasm seems to be the most popular. GAS is possible, but I found it to be a little inexorable and incomplete.

0
source

Source: https://habr.com/ru/post/1740560/


All Articles