some more work on the first set. I think it might actually be right now

This commit is contained in:
Nathan Braswell
2015-07-16 23:32:27 -04:00
parent 51adf491fa
commit f431b0305a
3 changed files with 11 additions and 8 deletions

View File

@@ -143,7 +143,9 @@ obj grammer (Object) {
for (var i = 0; i < rhs.size; i++;) {
var lookahead = first_set_map[rhs[i]]
if (lookahead.contains(symbol::null_symbol())) {
lookahead.remove(symbol::null_symbol())
// remove the null if this is not the last in the rule
if (i != rhs.size-1)
lookahead.remove(symbol::null_symbol())
toRet.add(lookahead)
} else {
toRet.add(lookahead)