码迷,mamicode.com
首页 > 其他好文 > 详细

High-level structure of a simple compiler高級結構的簡單編譯器

时间:2019-02-14 00:25:47      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:message   seq   anti   put   形式   dir   nes   orm   structure   

 

 

 

技术图片

技术图片

 

1.lexical analysis,which analyzes the character string presented to it and divides it up into tokens that are legal members of the vocabulary of the language in which the program is written (and may produce error messages if the character string is not parseable into a string of legal tokens);

2.syntactic analysis or parsing,which processes the sequence of tokens and produces an intermediate-level representation,such as a parse  tree or a sequential intermediate code,and a symbol  table that records the identifiers used in the program  and their attibutes.

3.checking of the program for static-semantic validity(or semantic checking),which takes as input the intermediate code and symbol table and determines whether the program satisfiers  the staic-semantic properties required by the source language.

4.code generation,which transforms the intermediate code into equivalent machine code in the form of a relocatable object module or directly runnable object code.


1.詞法分析,它分析呈現給它的字符串,並將其劃分為令牌,這些令牌是編寫程序的語言詞彙的合法成員(如果字符串不能解析成字符串,則可能產生錯誤消息。一串合法代幣);

2.語法分析或解析,它處理令牌序列並產生中間級表示,例如解析樹或順序中間代碼,以及記錄程序中使用的標識符及其屬性的符號表。

3.檢查程序的靜態語義有效性(或語義檢查),它將中間代碼和符號表作為輸入,並確定程序是否滿足源語言所需的基本語義屬性。

4.代碼生成,它以可重定位目標模塊或直接可運行目標代碼的形式將中間代碼轉換為等效的機器代碼。

High-level structure of a simple compiler高級結構的簡單編譯器

标签:message   seq   anti   put   形式   dir   nes   orm   structure   

原文地址:https://www.cnblogs.com/hoganben/p/10372414.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!