⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.1.1.htm

📁 建立《编译原理网络课程》的目的不仅使学生掌握构造编译程序的原理和技术
💻 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='preface.htm'" src="../images/previous.gif"></IMG></td>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='3.1.2a.htm'" src="../images/next.gif"></IMG></td>
</tr>
</table>
<br><br>
<center>
<font class="title1">第三章 词法分析</font><br>
<table border=0>
<table border=0>
	<tr>
		<td colspan=2>
			<DIV align=center>
			<table border=0 align=center>
				<tr align=center>
					<td align="center">
						<!--font class="title1"><p>第三章 词法分析</p></font-->
					</td>
				</tr>
			</table></DIV>
		</td>
	</tr>
	<tr>
		<td colspan=2>
			<br>
			<p>&nbsp;词法分析是整个分析过程的一个<font class="definition3">子任务</font>,它把构成源程序的字符串转换成语义上关联的单词符号的序列。词法分析比语法分析简单的多,可借助于有限自动机的理论与方法进行有效的处理。</p>
			<p>&nbsp;执行词法分析的程序称为词<font class="definition3">法分析程序</font>,或<font class="definition3">词法分析器</font>,或<font class="definition3">词法扫描器</font>。 </p>
<div align=left><b>观看演示 </b><font color=blue onmouseover="javascript:style.cursor='hand';" onclick="javascript:open('program/test3_1/cifa.htm','_blank','left=100,top=100,scrollbars=yes,resizable=yes,width=800,height=600')"> 编译原理词法分析演示</font><IMG src="../images/yanshi.gif"></div> 

		</td>
	<tr>
</table>
			<hr size=2 width=100% align=center color=red>
<br>
<table border=0  align=left>
	<tr>
		<td colspan=3 align=left>
			<font class="title2"><b>3.1&nbsp词法分析程序的设计</b></font>
		</td>
	</tr>
	<tr>
		<td>&nbsp;&nbsp;</td>
		<td colspan=2>
			<br>
			<b>3.1.2&nbsp词法分析程序的功能</b>
			<br><br>
		</td>
	</tr>
	
	<tr>
		<td width=10></td>
		<td>
			<p>一个源程序与一篇文章一样,是由单词符号组成的。如下所表示的一小段Pascal程序:</p> 
			<p>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<font color=#0000ff>while</font> i<>j <font color=#0000ff>do</font> <br> 
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<font color=#0000ff>if</font> i>j <font color=#0000ff>then</font> i:=i-j <font color=#0000ff>else</font>   j:=j-i
			</p> 
			<p>我们可以从程序中顺序找出如下单词:</p> 
			<p align="center">
			'while','i','<>','j', 'do', 'if','i','>','j',<br>
			'then', 'i',':=','i','-','j', 'else','j',':=','j','-','i'</p> 
			<p>这些单词都具有各自的意义,但它们不能再分小了。所以说单词符号是<font class="definition3">最小的语义单位</font>。单词符号是源程序的一个子串,然而并不是源程序的任何子串都是单词符号。词法分析器将自左至右读入源程序的字符,把那些具有独立意义的子串从源程序中一个一个地识别出来。因此,<font class="definition3">词法分析器程序的功能</font>是以字符串形式的源程序作为输入,并转换它为单词符号序列,以作为输出。这一转换是根据语法分析程序的需要而进行的。 

<table align=right width=300>
<tr>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='preface.htm'" src="../images/previous.gif"></IMG></td>
<td><IMG onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='3.1.2a.htm'" src="../images/next.gif"></IMG></td>
</tr>
</table>
</BODY>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -