📄 lalr_state.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_13) on Tue Jul 15 15:48:47 NZST 2008 --><TITLE>lalr_state</TITLE><META NAME="keywords" CONTENT="weka.core.parser.java_cup.lalr_state class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="lalr_state";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="http://www.cs.waikato.ac.nz/ml/weka/" target="_blank"><FONT CLASS="NavBarFont1"><B>Weka's home</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup"><B>PREV CLASS</B></A> <A HREF="../../../../weka/core/parser/java_cup/lalr_transition.html" title="class in weka.core.parser.java_cup"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?weka/core/parser/java_cup/lalr_state.html" target="_top"><B>FRAMES</B></A> <A HREF="lalr_state.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">weka.core.parser.java_cup</FONT><BR>Class lalr_state</H2><PRE>java.lang.Object <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>weka.core.parser.java_cup.lalr_state</B></PRE><HR><DL><DT><PRE>public class <B>lalr_state</B><DT>extends java.lang.Object</DL></PRE><P>This class represents a state in the LALR viable prefix recognition machine. A state consists of an LALR item set and a set of transitions to other states under terminal and non-terminal symbols. Each state represents a potential configuration of the parser. If the item set of a state includes an item such as: <pre> [A ::= B * C d E , {a,b,c}] </pre> this indicates that when the parser is in this state it is currently looking for an A of the given form, has already seen the B, and would expect to see an a, b, or c after this sequence is complete. Note that the parser is normally looking for several things at once (represented by several items). In our example above, the state would also include items such as: <pre> [C ::= * X e Z, {d}] [X ::= * f, {e}] </pre> to indicate that it was currently looking for a C followed by a d (which would be reduced into a C, matching the first symbol in our production above), and the terminal f followed by e.<p> At runtime, the parser uses a viable prefix recognition machine made up of these states to parse. The parser has two operations, shift and reduce. In a shift, it consumes one Symbol and makes a transition to a new state. This corresponds to "moving the dot past" a terminal in one or more items in the state (these new shifted items will then be found in the state at the end of the transition). For a reduce operation, the parser is signifying that it is recognizing the RHS of some production. To do this it first "backs up" by popping a stack of previously saved states. It pops off the same number of states as are found in the RHS of the production. This leaves the machine in the same state is was in when the parser first attempted to find the RHS. From this state it makes a transition based on the non-terminal on the LHS of the production. This corresponds to placing the parse in a configuration equivalent to having replaced all the symbols from the the input corresponding to the RHS with the symbol on the LHS.<P><P><DL><DT><B>Version:</B></DT> <DD>last updated: 7/3/96</DD><DT><B>Author:</B></DT> <DD>Frank Flannery</DD><DT><B>See Also:</B><DD><A HREF="../../../../weka/core/parser/java_cup/lalr_item.html" title="class in weka.core.parser.java_cup"><CODE>lalr_item</CODE></A>, <A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup"><CODE>lalr_item_set</CODE></A>, <A HREF="../../../../weka/core/parser/java_cup/lalr_transition.html" title="class in weka.core.parser.java_cup"><CODE>lalr_transition</CODE></A></DL><HR><P><!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#lalr_state(weka.core.parser.java_cup.lalr_item_set)">lalr_state</A></B>(<A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup">lalr_item_set</A> itms)</CODE><BR> Constructor for building a state from a set of items.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#add_transition(weka.core.parser.java_cup.symbol, weka.core.parser.java_cup.lalr_state)">add_transition</A></B>(<A HREF="../../../../weka/core/parser/java_cup/symbol.html" title="class in weka.core.parser.java_cup">symbol</A> on_sym, <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A> to_st)</CODE><BR> Add a transition out of this state to another.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static java.util.Enumeration</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#all()">all</A></B>()</CODE><BR> Collection of all states.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#build_machine(weka.core.parser.java_cup.production)">build_machine</A></B>(<A HREF="../../../../weka/core/parser/java_cup/production.html" title="class in weka.core.parser.java_cup">production</A> start_prod)</CODE><BR> Build an LALR viable prefix recognition machine given a start production.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#build_table_entries(weka.core.parser.java_cup.parse_action_table, weka.core.parser.java_cup.parse_reduce_table)">build_table_entries</A></B>(<A HREF="../../../../weka/core/parser/java_cup/parse_action_table.html" title="class in weka.core.parser.java_cup">parse_action_table</A> act_table, <A HREF="../../../../weka/core/parser/java_cup/parse_reduce_table.html" title="class in weka.core.parser.java_cup">parse_reduce_table</A> reduce_table)</CODE><BR> Fill in the parse table entries for this state.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#clear()">clear</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#equals(weka.core.parser.java_cup.lalr_state)">equals</A></B>(<A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A> other)</CODE><BR> Equality comparison.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object other)</CODE><BR> Generic equality comparison.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#find_state(weka.core.parser.java_cup.lalr_item_set)">find_state</A></B>(<A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup">lalr_item_set</A> itms)</CODE><BR> Find and return state with a given a kernel item set (or null if not found).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#hashCode()">hashCode</A></B>()</CODE><BR> Produce a hash code.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#index()">index</A></B>()</CODE><BR> Index of this state in the parse tables</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup">lalr_item_set</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#items()">items</A></B>()</CODE><BR> The item set for this state.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#number()">number</A></B>()</CODE><BR> Indicate total number of states there are.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#toString()">toString</A></B>()</CODE><BR> Convert to a string.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../weka/core/parser/java_cup/lalr_transition.html" title="class in weka.core.parser.java_cup">lalr_transition</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#transitions()">transitions</A></B>()</CODE><BR> List of transitions out of this state.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>getClass, notify, notifyAll, wait, wait, wait</CODE></TD></TR></TABLE> <P><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="lalr_state(weka.core.parser.java_cup.lalr_item_set)"><!-- --></A><H3>lalr_state</H3><PRE>public <B>lalr_state</B>(<A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup">lalr_item_set</A> itms) throws <A HREF="../../../../weka/core/parser/java_cup/internal_error.html" title="class in weka.core.parser.java_cup">internal_error</A></PRE><DL><DD>Constructor for building a state from a set of items.<P><DL><DT><B>Parameters:</B><DD><CODE>itms</CODE> - the set of items that makes up this state.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../weka/core/parser/java_cup/internal_error.html" title="class in weka.core.parser.java_cup">internal_error</A></CODE></DL></DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -