breck7 / scrollsdk

Build on top of Scroll.
https://sdk.scroll.pub
379 stars 17 forks source link

❓ allow blank lines in Grammar and perhaps add other node types to enable literate programming? #133

Closed breck7 closed 1 year ago

breck7 commented 3 years ago

Grammar is turning out to be a key language. Perhaps making it easier to add a little documentation might be helpful.

breck7 commented 3 years ago

Perhaps something like this:

Screen Shot 2021-05-19 at 6 02 39 AM

The huge pro is if it makes it easier for newcomers (and devs who haven't touched a lang in a while) to read the language source, with relatively little work. It would likely just be a few lines of code append (add a comment/section nodeType and blank line nodetype). In formatting, we could have a rule that you replace any 2+ blank lines with 1 blank line. We would lose the ability to auto sort the nodes, unless we introduced the concept of "sections" and autosorted those perhaps.

breck7 commented 2 years ago

could have blank lines be "section break". Then the default prettier behavior could be to format each section.

breck7 commented 1 year ago

~2 yrs later this is live in Grammar 4 (finally)

breck7 commented 1 year ago

Didn't solve the sorting but can do that later.