A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Front-End
In a compiler, the Front End (FE) lexically
analysis the source code to form tokens, which are syntactically analysed,
converted to some internal intermediate representation and semantically
checked.
1. Preprocessing - some languages (e.g., C
language) include a preprocessor. This generally occurs before syntactic
analysis.
2. Lexical analysis- breaking the
source code text into small pieces ('tokens' or 'terminals'), each representing
a single atomic unit of the language, for instance a keyword, identifier or
symbol name. The token language is typically a regular language, so a finite
state automaton constructed from a regular expression can be used to recognize
it. This phase is also called lexing or scanning. The program doing lexical
analysis is called a lexical analyzer or shortly a scanner.
3. Syntax analysis on parsing - Identifying
syntactic structures of source code, also named Parsing and conducted by a
parser. It only focuses on the structure. In other words, it identifies the
order of tokens and understands hierarchical structures in code acording to the
language.
4. Semantic analysis - Is to recognize the meaning
of program code and start to prepare for output. In that phase, type checking
is done and most of compiler errors show up. This happens in the parser.
5. Intermediate Representation - often briefed as
IR, an equivalent to the original program is transformed to an intermediate
representation. This can be a data-structure (typically a Tree or Graph) or an
Intermediate language.
6. Symbol Table - Working with intermediate
representation, symbol tables are auxiliary (optional) data structures where
each symbol in a program's source code is associated with information such as
location, type and scope level.