¿Como funciona un compilador? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

¿Como funciona un compilador?

17th Aug 2018, 9:49 PM
Gabriel Perez Perez
Gabriel Perez Perez - avatar
2 Answers
+ 2
A compiler is a program that translates the source code for another program from a programing language into executable code. The source code is typically in a high-level programming language (e. g. Pascal, C, C++, Java, Perl, C#, etc.). The executable code may be a sequence of machine instructions that can be executed by the CPU directly, or it may be an intermediate representation that is interpreted by a virtual machine (e. g. Java byte code). In short, a compiler converts a program from a human-readable format into a machine-readable format. As to how a compiler works, that is indeed complicated. There are books and university courses on the subject. I will attempt to briefly outline the main stages of the process, but this will be a very cursory overview. Lexing - break up the text of the program into "tokens". The tokens are the "words" of the programming language, such as identifiers (keywords, variable names, function names, etc.) or operators (=, *, &, etc.). Parsing - convert the sequence of to
18th Aug 2018, 6:35 AM
Mayur Shedage
Mayur Shedage - avatar
0
ok thank for your comment
22nd Aug 2018, 3:31 PM
Gabriel Perez Perez
Gabriel Perez Perez - avatar