| java.util.Hashtable fri.patterns.interpreter.parsergenerator.parsertables.Nullable
Nullable | class Nullable extends Hashtable (Code) | | Nullability of a nonterminal means that it can be "nothing", i.e.
there is a rule that contains the nonterminal on the left side and
no symbol on the right side (empty right side), expressing an optional
rule.
Algorithm:
Sort rules by size.
Search every rule that contain the nonterminal on left side.
Scan the left side of every rule until a terminal or a non-nullable
nonterminal appears. If found, rule is not nullable, else it is nullable.
If one of the rules that derive nonterminal is nullable, this nonterminal
is nullable.
author: (c) 2000, Fritz Ritzberger |
Field Summary | |
final public static String | NULL The special empty symbol. |
Constructor Summary | |
public | Nullable(Syntax syntax, List nonterminals) Explores the nullability of all nonterminals in syntax. |
Method Summary | |
public static boolean | isNull(String symbol) Detect an empty terminal in input grammar: length == 0, '', "", ``. | public boolean | isNullable(String nonterminal) Returns true if passed nonterminal is nullable, else false. | public static void | main(String[] args) |
NULL | final public static String NULL(Code) | | The special empty symbol.
|
Nullable | public Nullable(Syntax syntax, List nonterminals) throws ParserBuildException(Code) | | Explores the nullability of all nonterminals in syntax. Provides nullability
as Boolean within this Map, key is nonterminal.
Parameters: syntax - the grammar to scan for nonterminals and their nullability. Parameters: nonterminals - pre-built list of nonterminals. |
isNull | public static boolean isNull(String symbol)(Code) | | Detect an empty terminal in input grammar: length == 0, '', "", ``.
true when symbol is empty. |
isNullable | public boolean isNullable(String nonterminal)(Code) | | Returns true if passed nonterminal is nullable, else false.
|
|
|