Thursday, September 13, 2012

P4 - Pascal compiler And Interpreter

P4 - a compiler and interpreter implementation 
This post that provides the implement of  P4 compiler and interpreter. This implement are parted into two parts , one is compiler and the other is interpreter. In compiler , its implement just includes front end processing , that is lexical analysis , syntax analysis and  semantic analysis , parser tree construction , and code generation . let's construct them step by step. 

Lexical Analysis - 詞彙分析 
This is a process of converting a sequence of characters into a sequence of tokens   The following figure is a metaphor of it. 


A lexical analysis metphor
This module is responsible for  following  functionality :
1. Reading the input  ( 讀取輸入的字串流 ) 
2. producing a listing ( 產生一個列表 ) 
3. reporting errors ( 錯誤處理 ) 
4. splitting the input stream into distinct 'symbols' to be passed on to the next stage of the compiler  (將輸入字串流分成不同的"符號"並使他們傳送到下一個階段 ) 



No comments:

Post a Comment