Understand the relationship between assembly language and machine code.
Describe the use of an assembler in producing machine code.
Describe the difference between interpretation and compilation.
Describe the purpose of intermediate code in a virtual machine.
A parse is a scan of the code, it goes through, with a specific aim or looking for something in particular.
A compiler carries out 4 main parses:
Compiler parses over the code looking for key words.
It looks up the key words it finds to check that they exist.
Reports, with a false Boolean flag, if a word was found as an unacceptable key word.
It removes the superfluous (unneeded) characters, such as spaces, indentations and code comments.
This is the second parse, it scans through and looks for the syntax rules for the keywords and compares them to the source code.
For example it will report if there should be a bracket after using a certain keyword.
This is the next parse, it changes the high level code statements into low level code as binary numbers for the processor to understand.
It is a one to many process meaning that it creates many lines of low level instructions for each single high level line that is being translated, leaving the code in an executable format.
Often considered part of the code generation parse.
As the original code will not be very like to be the most efficient way, the compile parses through to optimise the code.
It removes lines that are not necessary to make the code as short as possible meaning it needs less space in memory and then the program can run more quickly.
A compiler will complete a parse on the source code multiple times when translating code. These include lexical analysis and syntax analysis. Lexical analysis is where the compiler scans over the code looking for
key words, it looks up these keywords, within each statement, to check that they exist. If it finds an unacceptable key word, a false Boolean flag will be generated, showing that it is an unacceptable key word. This parse will also remove superfluous characters, for example spaces and comments on the code.
Once this parse is complete, the syntax analysis parse starts. This checks the keywords against the syntax rules given for the keyword, and compares it to the code that was written, for example if something was meant to be followed by a comma. If it finds any errors, it then reports them.
This follows the lexical and syntax analysis parses. The code generation parse changes the high level source code into low level code as binary numbers. It is a one to many process, meaning that for one line of the source code, there are many lines of binary instructions. This means that the file size will be much larger as there is much more to be stored.
This follows the Code generation parse although is often considered part of it. It scans through looking for ways to optimise the code as it is unlikely that the code produced will be the most efficient version. It removes any remaining lines that are not necessary, meaning that the code will be as short as possible.
This means that the code will take up much less memory than the original code and so the program will run more quickly.