Skip to content

Reduce and document usage of exports #3

@tedinski

Description

@tedinski

After a chat with Patrick @200sc today, I realized we may be over-using the exports declaration.

Partly I think this was caused by melt-umn/copper#15 which demanded that concrete syntax get broken up into subgrammars, which is not a desirable design. We should make sure our examples are fixed now.

But right now, we have this as part of this standard skeleton:

https://github.com/melt-umn/ableC-skeleton/blob/master/grammars/edu.umn.cs.melt.exts.ableC.skeleton/Export.sv

This encourages the use of exports.

This file exists, I believe, for two reasons:

  1. We want to make it not possible to construct erroneous parsers, by automatically including dependent grammars because this file exports them. (i.e. when extensions extend extensions, you can't "leave out" the one in the middle because it gets magically added back in by an export relationship.)
  2. Convenience: just import the extension (or name it in a parser), without having to say :abstractsyntax or :concretesyntax.

IMO, ideally, we'd do away with this file, and not use exports by default at all. I think if we get melt-umn/silver#20 fixed, then the problem of leaving out grammars from a parser will no longer be a catastrophically confusing one. And the convenience doesn't seem worth it to me.

I think exposing new users to the exports concept can be especially confusing (especially since I think the only language that works similarly is Haskell, and I think it might even work slightly differently there, too...) The added burden of having to add :concretesyntax to grammars in parser declarations when telling our user story for composing extensions is minor. (And long term, we want "aspect parser" anyway to make that easy peasy.)


If we don't wish to do the above, then I think we need very, very good documentation of what's going on here and why. This file should not be devoid of comments.

cc @krame505 @ericvanwyk @TravisCarlson for discussion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions