-
Notifications
You must be signed in to change notification settings - Fork 0
/
LL1Table.java
41 lines (30 loc) · 940 Bytes
/
LL1Table.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
File: LL1Table.java
Author: zerksis d. umrigar (zdu@acm.org)
Copyright (C) 1997 Zerksis D. Umrigar
Last Update Time-stamp: "97/06/27 20:34:15 umrigar"
This code is distributed under the terms of the GNU General Public License.
See the file COPYING with this distribution, or
http://www.fsf.org/copyleft/gpl.html
THERE IS ABSOLUTELY NO WARRANTY FOR THIS PROGRAM.
*/
package zdu.parsdemo;
import zdu.parsdemo.SparseTable2;
import java.util.Enumeration;
import java.util.Hashtable;
abstract class LL1Table extends SparseTable2
{
LL1Table(Grammar g)
{
for (Enumeration e = g.nonTermsEnum(); e.hasMoreElements();)
{
addRow(e.nextElement());
}
for (Enumeration e = g.terminalsEnum(); e.hasMoreElements();)
{
Terminal terminal = (Terminal)e.nextElement();
if (terminal.getTok() >= 0)
addCol(terminal);
}
}
}