How does a compiler work?

Asked

Viewed 25 times

0

I’ve been studying and I feel a little confused when there’s a question.

In certain explanations, it is said that the most modern compilers translate high-level code into low-level code, Assembly (which then transforms it into binary).

PS: If the process I mentioned above is wrong, correct me!

That’s where my question is, are there compilers who transform direct high-level code into binary? It’s a silly question, I confess. I’m a junior computer science student.

  • Yes, what would be the impediment to this? Also have to define what is code "high level" and "low level". Rust, for example, can be viewed as "high level" and compiles to binary.

  • On "high level": https://answall.com/q/57309/112052

  • @brunohenriquef They can also compile to an intermediate code a little higher level than Assembly and platform independent, which in Java is called bytecode, term that seems to me to be used elsewhere as well (actually in Java it has two equivalent representations of intermediate code, one textual and one binary). In a quick search I suspect (I’m not sure) that Luiz Felipe is right to say that Rust can compile directly from the intermediate representation to the machine code without going through Assembly, but it seems to me that it can generate Assembly as well.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.