📄 3.1.3.htm
字号:
<html>
<head>
<title>编译原理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link type="text/css" rel="stylesheet" href="../css/specification.css">
</head>
<BODY bgColor=lavender>
<table align=right width=300>
<tr>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='3.1.2c.htm'" src="../images/previous.gif"></td>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='3.2.1a.htm'" src="../images/next.gif"></td>
</tr>
</table>
<br><br>
<table border=0>
<tr>
<td colspan=2>
<br>
<b>3.1.3 词法分析程序作为一个独立子程序</b>
<br><br>
</td>
</tr>
<tr>
<td height="190%" colspan="2"> <blockquote>
<p>把词法分析作为一个独立阶段的好处是,它可以使整个编译程序的结构更简洁、清晰和条理化。词法分析比语法分析要简单的多,可以用更有效的特殊方法和工具进行构造。这是本章后面将要讨论的主要问题。</p>
<p>但是,这并不意味着我们也必须把词法分析作为独立的一遍。如前面所讨论的,在实现时,往往把词法分析程序安排为语法分析程序的子程序。从程序的工作方式来看,这样的安排是比较自然的。如图3.1,在本书中,我们假定词法分析器是按这种方式工作的。</p>
<p>另外,如果需要,也可以把词法分析任务安排为独立的一遍。此时,语法分析程序不直接与词法分析程序发生作用。词法分析程序则把整个源程序转换成一个词类编码和属性值的二元式序列,建立一个单词文件。语法分析程序则通过该文件读取单词。</p>
<!--p align="center">图3.1 词法分析器和语法分析器的交互<br-->
<br>
<center>
<IMG src="IMG/3.1.gif">
<center>
<br>
</p></blockquote>
</td>
</tr>
</table>
<table align=right width=300>
<tr>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='3.1.2c.htm'" src="../images/previous.gif"></td>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='3.2.1a.htm'" src="../images/next.gif"></td>
</tr>
</table>
</BODY>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -