<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">

<html>

<!--(==============================================================)-->
<!--(Document created with RoboEditor. )============================-->
<!--(==============================================================)-->

<head>

<title>lookahead</title>

<!--(Meta)==========================================================-->

<meta name=generator content="RoboHELP by eHelp Corporation - www.ehelp.com">
<meta name=generator-major-version content=0.1>
<meta name=generator-minor-version content=1>
<meta name=filetype content=kadov>
<meta name=filetype-version content=1>
<meta name=page-count content=1>
<meta name=layout-height content=707>
<meta name=layout-width content=916>
<meta name=date content="05 4, 2002 10:56:26 PM">


<!--(Links)=========================================================-->

<link rel=StyleSheet href=default.css>



</head>

<!--(Body)==========================================================-->


<body>

<h1>lookahead</h1>

<h2>Purpose</h2>

<p>Designate the first lookahead element of a rule. The first node matching 
 the lookahead element or to the right of it will be the locus where the 
 rule matcher continues matching, after finishing with the current rule.</p>

<p>Unlike YACC, BISON, or other grammar frameworks that use a lookahead 
 or &quot;LR&quot; grammar, NLP++ rules require that lookahead constraints, 
 if any, be specified explicitly.</p>

<h2>Remarks</h2>

<p><span style="font-weight: bold;">look</span> is an alternate form for 
 lookahead.</p>

<!--(Table)=========================================================-->
<table x-use-null-cells
		wrapperparagraphselector=P
		style="width: 90%;
				border-spacing: 0px;
				margin-top: 14pt;"
		cellspacing=0
		width=90%>

<tr>
<td style="background-color: #ffffd5;
			x-cell-content-align: TOP;
			width: 100%;
			padding-left: 2px;
			padding-top: 2px;
			padding-right: 2px;
			padding-bottom: 2px;"
	valign=top
	bgcolor=#FFFFD5>
<p style="margin-bottom: 0; color: #008080;"><span style="font-weight: bold;">WARNING</span>: 
 A reduce action such as <span style="font-weight: bold;">singler</span> 
 or <span style="font-weight: bold;">noop</span> should be used to ensure 
 that the lookahead node and nodes to its right are not included in the 
 current rule reduction.<br>
<span style="font-weight: bold;">FEATURE:</span> The first element of a 
 rule cannot not be designated as a lookahead element. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->For 
 now, use the REC recursive pass algorithm to re-match nodes that have 
 been created or operated on by the rule matcher.</td></tr>
</table>

<h2>Example</h2>

<p># The rule below reduces a determiner, quantifier, adjective pattern 
 to a noun phrase as long as the subsequent node is not a noun.<br>
# The singler action reduces the first three elements and leaves the lookahead 
 element out of the reduction.<br>
# When the rule matcher is done with the current rule match, it will move 
 to the node that matched the lookahead element of the current rule.<br>
# (Without the lookahead element modifier, the rule matcher normally would 
 continue at the node <span style="font-style: italic;">after</span> the 
 one matching the 4th element of the rule.)<br>
@POST<br>
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->singler(1,3);<br>
@RULES<br>
_np &lt;-<br>
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->_det<br>
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->_quan<br>
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->_adj<br>
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->_xWILD 
 [one lookahead fail=(_noun)] <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}--># 
 Lookahead element.<br>
 <!--kadov_tag{{<spaces>}}-->&nbsp;&nbsp;&nbsp;<!--kadov_tag{{</spaces>}}-->@@</p>

<h2>See Also</h2>

<p><a href="trigger.htm">trigger</a>, <a href="NLP_PP_Stuff/Phrase_element_modifiers.htm">Phrase 
 Element Modifiers</a></p>

</body>

</html>
