lalr_state.html

来自「数据挖掘的最常用工具。由于开源」· HTML 代码 · 共 650 行 · 第 1/2 页

HTML
650
字号
<!-- ============ METHOD DETAIL ========== --><A NAME="method_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>Method Detail</B></FONT></TH></TR></TABLE><A NAME="all()"><!-- --></A><H3>all</H3><PRE>public static java.util.Enumeration <B>all</B>()</PRE><DL><DD>Collection of all states.<P><DD><DL></DL></DD></DL><HR><A NAME="clear()"><!-- --></A><H3>clear</H3><PRE>public static void <B>clear</B>()</PRE><DL><DD><DL></DL></DD></DL><HR><A NAME="number()"><!-- --></A><H3>number</H3><PRE>public static int <B>number</B>()</PRE><DL><DD>Indicate total number of states there are.<P><DD><DL></DL></DD></DL><HR><A NAME="find_state(weka.core.parser.java_cup.lalr_item_set)"><!-- --></A><H3>find_state</H3><PRE>public static <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A> <B>find_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>&nbsp;itms)</PRE><DL><DD>Find and return state with a given a kernel item set (or null if not   found).  The kernel item set is the subset of items that were used to  originally create the state.  These items are formed by "shifting the  dot" within items of other states that have a transition to this one.  The remaining elements of this state's item set are added during closure.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>itms</CODE> - the kernel set of the state we are looking for.</DL></DD></DL><HR><A NAME="items()"><!-- --></A><H3>items</H3><PRE>public <A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup">lalr_item_set</A> <B>items</B>()</PRE><DL><DD>The item set for this state.<P><DD><DL></DL></DD></DL><HR><A NAME="transitions()"><!-- --></A><H3>transitions</H3><PRE>public <A HREF="../../../../weka/core/parser/java_cup/lalr_transition.html" title="class in weka.core.parser.java_cup">lalr_transition</A> <B>transitions</B>()</PRE><DL><DD>List of transitions out of this state.<P><DD><DL></DL></DD></DL><HR><A NAME="index()"><!-- --></A><H3>index</H3><PRE>public int <B>index</B>()</PRE><DL><DD>Index of this state in the parse tables<P><DD><DL></DL></DD></DL><HR><A NAME="add_transition(weka.core.parser.java_cup.symbol, weka.core.parser.java_cup.lalr_state)"><!-- --></A><H3>add_transition</H3><PRE>public void <B>add_transition</B>(<A HREF="../../../../weka/core/parser/java_cup/symbol.html" title="class in weka.core.parser.java_cup">symbol</A>&nbsp;on_sym,                           <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A>&nbsp;to_st)                    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>Add a transition out of this state to another.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>on_sym</CODE> - the symbol the transition is under.<DD><CODE>to_st</CODE> - the state the transition goes to.<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></DD></DL><HR><A NAME="build_machine(weka.core.parser.java_cup.production)"><!-- --></A><H3>build_machine</H3><PRE>public static <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A> <B>build_machine</B>(<A HREF="../../../../weka/core/parser/java_cup/production.html" title="class in weka.core.parser.java_cup">production</A>&nbsp;start_prod)                                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>Build an LALR viable prefix recognition machine given a start   production.  This method operates by first building a start state  from the start production (based on a single item with the dot at  the beginning and EOF as expected lookahead).  Then for each state  it attempts to extend the machine by creating transitions out of  the state to new or existing states.  When considering extension  from a state we make a transition on each symbol that appears before  the dot in some item.  For example, if we have the items: <pre>    [A ::= a b * X c, {d,e}]    [B ::= a b * X d, {a,b}]  </pre>  in some state, then we would be making a transition under X to a new  state.  This new state would be formed by a "kernel" of items   corresponding to moving the dot past the X.  In this case: <pre>    [A ::= a b X * c, {d,e}]    [B ::= a b X * Y, {a,b}]  </pre>  The full state would then be formed by "closing" this kernel set of   items so that it included items that represented productions of things  the parser was now looking for.  In this case we would items   corresponding to productions of Y, since various forms of Y are expected  next when in this state (see lalr_item_set.compute_closure() for details   on closure). <p>  The process of building the viable prefix recognizer terminates when no  new states can be added.  However, in order to build a smaller number of  states (i.e., corresponding to LALR rather than canonical LR) the state   building process does not maintain full loookaheads in all items.    Consequently, after the machine is built, we go back and propagate   lookaheads through the constructed machine using a call to   propagate_all_lookaheads().  This makes use of propagation links   constructed during the closure and transition process.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>start_prod</CODE> - the start production of the grammar<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><DT><B>See Also:</B><DD><A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html#compute_closure()"><CODE>lalr_item_set.compute_closure()</CODE></A>, <A HREF="../../../../weka/core/parser/java_cup/lalr_state.html#propagate_all_lookaheads()"><CODE>propagate_all_lookaheads()</CODE></A></DL></DD></DL><HR><A NAME="build_table_entries(weka.core.parser.java_cup.parse_action_table, weka.core.parser.java_cup.parse_reduce_table)"><!-- --></A><H3>build_table_entries</H3><PRE>public void <B>build_table_entries</B>(<A HREF="../../../../weka/core/parser/java_cup/parse_action_table.html" title="class in weka.core.parser.java_cup">parse_action_table</A>&nbsp;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>&nbsp;reduce_table)                         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>Fill in the parse table entries for this state.  There are two   parse tables that encode the viable prefix recognition machine, an   action table and a reduce-goto table.  The rows in each table   correspond to states of the machine.  The columns of the action table  are indexed by terminal symbols and correspond to either transitions   out of the state (shift entries) or reductions from the state to some  previous state saved on the stack (reduce entries).  All entries in the  action table that are not shifts or reduces, represent errors.    The  reduce-goto table is indexed by non terminals and represents transitions   out of a state on that non-terminal.<p>  Conflicts occur if more than one action needs to go in one entry of the  action table (this cannot happen with the reduce-goto table).  Conflicts  are resolved by always shifting for shift/reduce conflicts and choosing  the lowest numbered production (hence the one that appeared first in  the specification) in reduce/reduce conflicts.  All conflicts are   reported and if more conflicts are detected than were declared by the  user, code generation is aborted.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>act_table</CODE> - the action table to put entries in.<DD><CODE>reduce_table</CODE> - the reduce-goto table to put entries in.<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></DD></DL><HR><A NAME="equals(weka.core.parser.java_cup.lalr_state)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(<A HREF="../../../../weka/core/parser/java_cup/lalr_state.html" title="class in weka.core.parser.java_cup">lalr_state</A>&nbsp;other)</PRE><DL><DD>Equality comparison.<P><DD><DL></DL></DD></DL><HR><A NAME="equals(java.lang.Object)"><!-- --></A><H3>equals</H3><PRE>public boolean <B>equals</B>(java.lang.Object&nbsp;other)</PRE><DL><DD>Generic equality comparison.<P><DD><DL><DT><B>Overrides:</B><DD><CODE>equals</CODE> in class <CODE>java.lang.Object</CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="hashCode()"><!-- --></A><H3>hashCode</H3><PRE>public int <B>hashCode</B>()</PRE><DL><DD>Produce a hash code.<P><DD><DL><DT><B>Overrides:</B><DD><CODE>hashCode</CODE> in class <CODE>java.lang.Object</CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public java.lang.String <B>toString</B>()</PRE><DL><DD>Convert to a string.<P><DD><DL><DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL></DD><DD><DL></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" 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_bottom_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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</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>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../../weka/core/parser/java_cup/lalr_item_set.html" title="class in weka.core.parser.java_cup"><B>PREV CLASS</B></A>&nbsp;&nbsp;<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>  &nbsp;&nbsp;<A HREF="lalr_state.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<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:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>

⌨️ 快捷键说明

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