Difference between revisions of "Front-End"

From eplmediawiki
Jump to: navigation, search
Line 3: Line 3:
  
 
# '''Preprocessing''' - some languages (e.g., C language) include a preprocessor. This generally occurs before syntactic analysis.  
 
# '''Preprocessing''' - some languages (e.g., C language) include a preprocessor. This generally occurs before syntactic analysis.  
<br><br>
 
 
# '''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.  
 
# '''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.  
<br><br>
+
 
 
# '''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.  
 
# '''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.  
<br><br>
+
 
 
# '''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.  
 
# '''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.  
<br><br>
+
 
 
# '''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.  
 
# '''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.  
<br><br>
+
 
 
# '''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.  
 
# '''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.  
  
 
[[Category:Basic Concepts]]
 
[[Category:Basic Concepts]]

Revision as of 19:39, 24 November 2012

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.
  1. 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.
  1. 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.
  1. 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.
  1. 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.
Personal tools
Namespaces

Variants
Actions
Navigation
extras
Toolbox