silver icon indicating copy to clipboard operation
silver copied to clipboard

Lexer class flattening causes spurious MDA warnings about references to an external symbol

Open krame505 opened this issue 1 year ago • 0 comments

I finally traced down why the MDA for silver-ableC has a bunch of warnings of the form

edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation/Terminals.sv:25.0 [parser edu_umn_cs_melt_ableC_silverconstruction_mda_test_testAntiquote] [grammar host]: The host grammar of an extended parser may not contain a reference to external symbol '$Decl' (edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation:AntiquoteDecl_t)
edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation/Terminals.sv:26.0 [parser edu_umn_cs_melt_ableC_silverconstruction_mda_test_testAntiquote] [grammar host]: The host grammar of an extended parser may not contain a reference to external symbol '$Stmt' (edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation:AntiquoteStmt_t)
edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation/Terminals.sv:27.0 [parser edu_umn_cs_melt_ableC_silverconstruction_mda_test_testAntiquote] [grammar host]: The host grammar of an extended parser may not contain a reference to external symbol '$Initializer'
edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation/Terminals.sv:28.0 [parser edu_umn_cs_melt_ableC_silverconstruction_mda_test_testAntiquote] [grammar host]: The host grammar of an extended parser may not contain a reference to external symbol '$Exprs'
edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation/Terminals.sv:29.0 [parser edu_umn_cs_melt_ableC_silverconstruction_mda_test_testAntiquote] [grammar host]: The host grammar of an extended parser may not contain a reference to external symbol '$Expr' (edu:umn:cs:melt:ableC:silverconstruction:concretesyntax:antiquotation:AntiquoteExpr_t)

This is apparently because when the dominates/submits relationships involving lexer classes are being flattened, we end up with terminals in the host grammar that dominate/submit to extension terminals.

Low priority, but wanted to make a note of this for posterity. I think the solution requires a change to how flattening works, to ensure that dominates/submits to relationships between host and extension terminals are only ever specified in the extension grammar in the MDA spec we give to Copper.

This error is only showing up here at all because we have extension terminals that dominate host terminals. That should in itself be a warning or error in the MDA.

krame505 avatar Sep 04 '24 05:09 krame505