# The 'a' could be CPSd to make this grammar less inadequate.
S -> OPT1 a.
# The 'a' would be CPSd which would make this grammar less inadequate.
OPT1 -> OPT2 a.
OPT2 -> a.
OPT2 -> .
# CPSing both 'a's makes this grammar SLR(1), CPSing only the 'a' after 'OPT2' doesn't help much.
CPSing the OPT2, as the paper describes, because it is CPS-eligible, doesn't seem to help much with making the grammar adequate. Doing that and CPSing the a after OPT1would make the grammar SLR(1).
This feels like an opportunity where the CPS approach can be improved, that is, maybe the CPS-eligibility definition could benefit from being loosened to include symbols that are not limited to fresh symbols created during the flattening procedure.
Consider the following grammar (in grammophone syntax):
CPSing the
OPT2
, as the paper describes, because it is CPS-eligible, doesn't seem to help much with making the grammar adequate. Doing that and CPSing thea
afterOPT1
would make the grammar SLR(1).This feels like an opportunity where the CPS approach can be improved, that is, maybe the CPS-eligibility definition could benefit from being loosened to include symbols that are not limited to fresh symbols created during the flattening procedure.