Application Generation (4)

Get Started. It's Free
or sign up with your email address
Application Generation (4) by Mind Map: Application Generation (4)

1. Syntax Analysis (Parsing)

1.1. - Checks the grammar of a programming language. (The rules of the language) - Creates an Abstract Syntax Tree (parse tree) from a stream of symbols. - The purpose is to check that a program is syntactically correct. - If an error is found, a diagnostic message is sent showing where the error occurs.

2. Code Generation & Optimisation

2.1. Code Generation By this stage, the program is represented as an abstract syntax tree. Code generation is when the compiler converts this into object code. (Code produce by compiler)

2.2. Optimisation - Optimisation is ensuring the program runs as quickly as possible or uses as little memory as possible. - The optimiser will find lines of code and see if there is a more efficient alternative. - This process usually happens after the code generation stage.

3. Lexical Analysis (Scanning)

3.1. Identifies the LEXEMES in a sentence. (Lexeme - A meaningful unit of language) Converts each lexeme to a TOKEN. Throws away any ignorable text such as spaces, new-lines and comments.

3.2. Lexical Analysis Summary - Source program is used as the input. - Tokens are created for individual lexemes - Tokens are fixed length strings of binary units. - Variables names are loaded into a look-up table. - Redundant spaces are removed. - Comments are removed - Error diagnostics are given - Prepares code for syntax analysis.

4. Tokens?

4.1. Every token has an identifier, used to denote (Stands for) the kind of lexeme that it represents.

5. Linkers & Loaders

5.1. - Once code has been generated and optimised it is still not quite ready to run. - There is a good chance it will rely on code from libraries. It is the job of the linker to include this library code and all the compiled files in to single final executable file. - Linker can be static or dynamic.

5.1.1. When using static linking, all library code needed is put directly into the program when it is complied. This means that the final program can be large in size and a computer could have a number of different programs, each with their own separate copy of library routines embedded within them. Dynamic linking tries to circumvent this problem. Complied verisons of the library are stored and the operating system links a program to them when it is run.

5.2. A loader is part of the operating system and is responsible for loading a program into the memory.