symbol

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.core.parser.java_cup
Class symbol

    java.lang.Object
      weka.core.parser.java_cup.symbol

Direct Known Subclasses:
  non_terminal, terminal

    public abstract class symbol

extends java.lang.Object

This abstract class serves as the base class for grammar symbols (i.e., both terminals and non-terminals). Each symbol has a name string, and a string giving the type of object that the symbol will be represented by on the runtime parse stack. In addition, each symbol maintains a use count in order to detect symbols that are declared but never used, and an index number that indicates where it appears in parse tables (index numbers are unique within terminals or non terminals, but not across both).

Version:
  last updated: 7/3/96
Author:
  Frank Flannery
See Also:
  `terminal`, `non_terminal`

Constructor Summary
`symbol(java.lang.String nm)` Constructor with default type.
`symbol(java.lang.String nm, java.lang.String tp)` Full constructor.

Method Summary
`int` | `index()` Index of this symbol (terminal or non terminal) in the parse tables.
`abstract boolean` | `is_non_term()` Indicate if this is a non-terminal.
`java.lang.String` | `name()` String for the human readable name of the symbol.
`void` | `note_use()` Increment the use count.
`java.lang.String` | `stack_type()` String for the type of object used for the symbol on the parse stack.
`java.lang.String` | `toString()` Convert to a string.
`int` | `use_count()` Count of how many times the symbol appears in productions.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### symbol

    public symbol(java.lang.String nm,
                  java.lang.String tp)

  Full constructor.

  Parameters:
    `nm` - the name of the symbol.
    `tp` - a string with the type name.

### symbol

    public symbol(java.lang.String nm)

  Constructor with default type.

  Parameters:
    `nm` - the name of the symbol.

Method Detail

### name

    public java.lang.String name()

  String for the human readable name of the symbol.

### stack_type

    public java.lang.String stack_type()

  String for the type of object used for the symbol on the parse stack.

### use_count

    public int use_count()

  Count of how many times the symbol appears in productions.

### note_use

    public void note_use()

  Increment the use count.

### index

    public int index()

  Index of this symbol (terminal or non terminal) in the parse tables. Note: indexes are unique among terminals and unique among non terminals, however, a terminal may have the same index as a non-terminal, etc.

### is_non_term

    public abstract boolean is_non_term()

  Indicate if this is a non-terminal. Here in the base class we don't know, so this is abstract.

### toString

    public java.lang.String toString()

  Convert to a string.

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD