public class non_terminal extends symbol
Modifier and Type | Field and Description |
---|---|
protected static Hashtable<String,non_terminal> |
_all
Table of all non-terminals -- elements are stored using name strings
as the key
|
protected static Hashtable<Integer,non_terminal> |
_all_by_index
Table of all non terminals indexed by their index number.
|
protected terminal_set |
_first_set
First set for this non-terminal.
|
protected boolean |
_nullable
Nullability of this non terminal.
|
protected Hashtable<production,production> |
_productions
Table of all productions with this non terminal on the LHS.
|
boolean |
is_embedded_action
flag non-terminals created to embed action productions
|
protected static int |
next_index
Static counter to assign unique indexes.
|
protected static int |
next_nt
Static counter for creating unique non-terminal names
|
static non_terminal |
START_nt
special non-terminal for start symbol
|
_index, _name, _stack_type, _use_count
Constructor and Description |
---|
non_terminal(String nm)
Constructor with default type.
|
non_terminal(String nm,
String tp)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add_production(production prod)
Add a production to our set of productions.
|
static Enumeration<non_terminal> |
all()
Access to all non-terminals.
|
static void |
clear() |
static void |
compute_first_sets()
Compute first sets for all non-terminals.
|
static void |
compute_nullability()
Compute nullability of all non-terminals.
|
static non_terminal |
find(int indx)
Lookup a non terminal by index.
|
static non_terminal |
find(String with_name)
lookup a non terminal by name string
|
terminal_set |
first_set()
First set for this non-terminal.
|
boolean |
is_non_term()
Indicate that this symbol is a non-terminal.
|
protected boolean |
looks_nullable()
Test to see if this non terminal currently looks nullable.
|
boolean |
nullable()
Nullability of this non terminal.
|
int |
num_productions()
Total number of productions with this non terminal on the LHS.
|
static int |
number()
Total number of non-terminals.
|
Enumeration<production> |
productions()
Access to productions with this non terminal on the LHS.
|
String |
toString()
convert to string
|
protected static Hashtable<String,non_terminal> _all
protected static Hashtable<Integer,non_terminal> _all_by_index
protected static int next_index
protected static int next_nt
public static final non_terminal START_nt
public boolean is_embedded_action
protected Hashtable<production,production> _productions
protected boolean _nullable
protected terminal_set _first_set
public non_terminal(String nm, String tp)
nm
- the name of the non terminal.tp
- the type string for the non terminal.public non_terminal(String nm)
nm
- the name of the non terminal.public static void clear()
public static Enumeration<non_terminal> all()
public static non_terminal find(String with_name)
public static non_terminal find(int indx)
public static int number()
public static void compute_nullability() throws internal_error
internal_error
public static void compute_first_sets() throws internal_error
internal_error
public Enumeration<production> productions()
public int num_productions()
public void add_production(production prod) throws internal_error
internal_error
public boolean nullable()
public terminal_set first_set()
public boolean is_non_term()
is_non_term
in class symbol
protected boolean looks_nullable() throws internal_error
internal_error
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.