jzimmerman / langcc

langcc: A Next-Generation Compiler Compiler

Home Page:https://langcc.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improving CPS.

modulovalue opened this issue · comments

Consider the following grammar (in grammophone syntax):

# 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 OPT1 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.

Because langcc appears to be abandoned, I'm going to close this issue.