📄 7.3.4.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='7.3.3c.htm'"></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='7.4.1.htm'"></img></td>
</tr>
</table>
<br><br>
<font class="title2"><b>7.3.4 访问记录中的域</b></font>
<table><tr><td>    </td>
<td class="content">
<p>
编译器必须将记录的域的类型和相对地址保持下来。一般说来,把这些信息保存在相应域名的符号表表项之中。这样作的好处是,可以把用在符号表中查找名字的程序同样用来查找域名。在此意义下,利用上一节图7.7中的语义动作可为每一个记录类型,建立一张单独的符号表。在编译进行中,如果t是一个指向某个记录类型的指针,则record(t)表示t所指向的那个记录类型。对于用户而言,在源程序中可以访问记录的域名。例如,可以出现如下的表达式:
<BR> p↑.info+1
<BR> 其中变量P是一个指向某个记录类型的指针,在此记录中有一个类型为算术型的域名info。在编译程序内部可以把P的类型表示为: <BR>
pointer(record(t))
<BR> 即p的类型是一个指针,此指针指向某个t所指向的那个记录。于是p↑的类型是record(t),t可由此被选取出来。也就是说,域名info将可以在t所指向的符号表中查找。
</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='7.3.3c.htm'"></img></td>
<td><img src="../images/next.gif" onmouseover="javascript:style.cursor='hand'" onclick="vbscript:window.location.href='7.4.1.htm'"></img></td>
</tr>
</table>
</BODY>
<html><script language="JavaScript">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -