silver icon indicating copy to clipboard operation
silver copied to clipboard

AGDcl vs Dcl vs Decl

Open remexre opened this issue 3 years ago • 5 comments

We're inconsistent in how we name AGDcl productions. Amongst non-forwarding ones:

AGDcl:

  • errorAGDcl
  • emptyAGDcl
  • appendAGDcl
  • defsAGDcl

Dcl:

  • annotationDcl
  • aspectFunctionDcl
  • aspectProductionDcl
  • attributeDclInh
  • attributeDclSyn
  • defaultAttributionDcl
  • errorAttributionDcl
  • functionDcl
  • globalValueDclConcrete
  • instanceDcl
  • jarNameDcl
  • nonterminalDcl
  • productionDcl
  • typeClassDcl
  • terminalDclDefault
  • flowtypeDcl
  • flowtypeAttrDcl
  • collectionAttributeDclInh
  • collectionAttributeDclSyn
  • parserDcl
  • disambiguationGroupDcl
  • attributeDclParser
  • attributeAspectParser
  • copperMdaDcl
  • aspectDefaultProduction
  • ffiTypeDclUgly

Decl:

  • typeAliasDecl
  • lexerClassDecl

IMO we should either

  1. rename AGDcl to Decl and change to uniformly be Decl
  2. change to uniformly be AGDcl

Primary considerations:

  • If the production name is going to have a suffix to identify the nonterminal, it really ought to match the nonterminal
  • We shouldn't do Dcl since a lot of DclInfo productions use Dcl as a suffix (though we could refactor that too)
  • Decl is IMO preferable to AGDcl, since the only kinds of Decls we have are Silver/attribute grammar ones (not including the tutorial)

remexre avatar Jun 30 '21 01:06 remexre

Yeah, I agree it's kind of a mess. I'm not sure what the best convention to follow is though, if it is worth cleaning this up.

Decl is IMO preferable to AGDcl, since the only kinds of Decls we have are Silver/attribute grammar ones (not including the tutorial)

We also have "production statements" some of which are definitely declarations, so I'm not a huge fan of just Decl (although AGDcl itself doesn't really help to clarify things there that much...) Also ableC has Decls, would be another small point of confusion in silver-ableC.

Maybe GlobalDecl? IDK.

krame505 avatar Jun 30 '21 01:06 krame505

On the topic of bad names (expect more of these, I'm defining an aspect on every non-forwarding prod in the Silver syntax tree), nilModuleStmts vs consModulesStmts... (consModulesStmts)

remexre avatar Jun 30 '21 03:06 remexre

Another inconsistency:

  • nilFoo
  • nilFoos
  • foosNil

(resp cons, one, append)

remexre avatar Jun 30 '21 05:06 remexre

seperatedTerminalPrefix is misspelled (at this point making notes for myself when I go back to fix all these)

remexre avatar Jun 30 '21 06:06 remexre

I fully support refactoring all of this.

I like Decl. Lucas is right that there are declarations in other places, but they are local ones and we can have a more specific name for them.

The Silver style guide - http://melt.cs.umn.edu/silver/style-guide/, yes there is one - might be considered and updated in doing this. It suggests nilFoo and consFoo for lists.

Thanks!

ericvanwyk avatar Jun 30 '21 14:06 ericvanwyk