breck7 / scrollsdk

The code for Particles and Parsers, which Scroll is built on.
https://sdk.scroll.pub
383 stars 17 forks source link

Grammar: come up with a convention for handling multiple uses of a keyword in a map #181

Closed breck7 closed 4 months ago

breck7 commented 1 year ago

Currently in Scroll the way the groups keyword is implemented is that the last instance of it overwrites any earlier instances. Right now I have a situation where I have a file with 2 groups lines and I want to join the values of those lines into one. But I could imagine I might have situations where I want the last one to win.

This general situation seems to come up in Tree Languages a lot. Is there a semantic convention that would work everywhere, for explicitly declaring what behavior is desired? The choices seem to be:

I'm not sure if this should be done at the Grammar level or just in the implementations of various languages. Just posting it here now to think out loud.

breck7 commented 4 months ago

There turned out to be a better way to do this in Scroll. not sure if needed