Skip to content

Importing a set of sentences from a module #2115

@dwightguth

Description

@dwightguth

We want to improve the module signatures feature by allowing the type of "import foo from BAR` syntax present in most other import systems. Here are three possible syntaxes for consideration:

  1. Sentence label
module FOO
  syntax [foo]: Foo ::= foo(Foo) 
  syntax [bar]: Foo ::= foo(Bar)
endmodule

module BAR
  imports FOO.foo
  imports FOO.foo as bar(_)
endmodule

Potential problems: you can't import something without help from someone who can modify the module being imported from. You also have trouble with sentence labels and pipes mixing.

  1. Sentence tag
module FOO
  syntax Foo ::= foo(Foo) [tag(foo)]
  syntax Foo ::= foo(Bar) [tag(bar)]
endmodule

module BAR
  imports FOO.foo
  imports FOO.foo as bar(_)
endmodule

Basically the same but uses the tag attribute instead of the sentence label. Allows multiple sentences to be given the same tag, which could introduce complexity when it comes to renaming.

  1. Explicit syntax
module FOO
  syntax Foo ::= foo(Foo)
  syntax Foo ::= foo(Bar)
endmodule

module BAR
  imports 
    syntax Foo ::= foo(Foo)
    syntax Bar ::= foo(Bar) => bar(_)
  from FOO
endmodule

Requires you to basically redeclare what you import, but is the most flexible.

Metadata

Metadata

Assignees

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