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

📄 4.6.0.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>

<table align=right width=300>
<tr>
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.5.2.1b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.6.0b.htm'"></img></td>
</tr>
</table>
<br><br>
<font class="title2"><b>4.6 算符优先分析法 </b></font>      
<table><tr><td>&nbsp&nbsp&nbsp&nbsp</td>     
<td class="content">     
<p>算符优先分析法是一种简单直观、广为使用的自底向上分析法。这种方法特别有利于分析表达式,我们能很容易地用手工构造它的有效的“移进-归约”分析器。算符优先分析法适用于下面定义的一个虽小然而重要的文法类。 </p>  
<p>
<img class="dingyi" src="../images/dingyi.gif"> 
<font class="definition2">定义4.5  </font>设G是一个文法,如果G中不存在形如A→ε及A→αBCβ的产生式(其中A,B,C为非终结符号,α,β为文法符号串),即G中没有右部为ε或右部具有相邻非终结符号的产生式,则称G为算符文法。 </p>    
<p>例如,表达式文法 <br>   
&nbsp;&nbsp;&nbsp;&nbsp;E→E+E|E-E|E*E|E/E|E^E|(E)|-E|id               (4.13 ) <br>   
&nbsp;&nbsp;&nbsp;&nbsp;是算符文法。但是,文法<br>    
&nbsp;&nbsp;&nbsp;&nbsp;E→EAE|(E)|-E|id  <br>
&nbsp;&nbsp;&nbsp;&nbsp;A→+|-|*|/|^    <br>   
&nbsp;&nbsp;&nbsp;&nbsp;不是算符文法。因右部EAE具有相邻非终结符号。</p> 
  
<p>所谓算符优先分析法是仿照算术表达式的四则运算过程而设计的一种语法分析方法。这种方法要规定运算符号(更一般地说是终结符号)之间的优先关系和结合性质。然后利用这种关系比较相邻运算符之间的优先级来确定可归约串并进行归约。 </p>

</td></tr></table>  
     
<br>     
<table align=right width=300>     
<tr>     
<td><img src="../images/previous.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.5.2.1b.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='4.6.0b.htm'"></img></td>
</tr>     
</table>     
     
</BODY>     
</html>
<html><script language="JavaScript">

⌨️ 快捷键说明

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