]> ocean-lang.org Git - ocean/commit
parsergen: add action tables when needed.
authorNeilBrown <neil@brown.name>
Sun, 14 Nov 2021 05:07:15 +0000 (16:07 +1100)
committerNeilBrown <neil@brown.name>
Sun, 14 Nov 2021 05:07:15 +0000 (16:07 +1100)
commit728fde45c4ead92c216be0ee7d1db3019e518aef
treea08535effbd1be97986a3bce9e4445999e6d6ad6
parent10db06aed6af588a0ccd05e80a0f50286949d56c
parsergen: add action tables when needed.

In most cases there is at most one reducible production per state, and
that is all we previously handled.
However occasionally it can be useful to have more than one, triggered
by different look-ahead symbols.

With this patch, we add entries to the go_to table in that case.  The
go_to table now has a flag to indicate if the symbol maps to a state (in
which case it can be SHIFTed if a terminal), or to a production (in
which case it triggers a reduction).

If the in-state production has the special value MANY_REDUCIBLE, when
the parser performs a lookup to see which production, if any, should be
reduced.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/parsergen.mdc