The purpose is to convert the source program into a series of token that are passed on to the Syntax Analysis.
The functions that the lexical analysis might perform include the following:
- Removing white space - white space is all program code that is superfluous to the meaning of the programs and includes comments, spaces, tabs and new-line characters.
- Identifying the individual words, operators etc. (Known as syntactic units) in the program.
- Create a symbol table. The symbol table will contain details of each symbol used in the program. A symbol might be a function name, a variable name, etc. The Symbol table will be used by the later stages of the compiler. It will contain the symbol name plus information about the item, e.g. an Integer, a procedure.
- It keeps track of line numbers.
- It produces an output listing.
- Each Reserved word, operator, etc. will be converted into a token to be passed to syntax analyser.
Comments
No comments have yet been made