waterbearlang / moonshine

A programming language that maps nicely to blocks
2 stars 0 forks source link

Simplify Moonshine syntax #23

Open dethe opened 2 years ago

dethe commented 2 years ago

Unify file / unit / script / library concepts. No syntax needed to start a file (which is a unit/library/script).

Allow metadata headers in the file (and probably other objects like sprite). Lines are metadata until a line without a colon is hit so you can have things like

name: Control
author: Jesse Faden
created on: Juneteenth of 2020
hue: 20
/* and then the rest of the library */

Hopefully this can simplify both Moonshine syntax and the AST (and thus JSON)

Objects within the library can be intermixed, but will be grouped together in the AST (so all blockdefs will be in one blockdefs list), so Moonshine -> AST is not perfectly round-trippable, but will be like running a beautifier over it.

If media is inlined, it will always be at the end of the file after three moon emojis.

Allow non-trigger block calls in the library, but grey them out in Tardigrade to show that they are not being called unless they're in a trigger call. Maybe you can double-click them like in Scratch.

dethe commented 2 years ago

The metadata is working well, but needs to be consistent across objects. Sounds and costumes for instance can be purely metadata (plus the complexities of caching).

Unifying unit/library/file has also made the AST much more manageable (less deeply nested). So far I think code will be easier to write and the code will be much easier to work with, with more generalities to exploit. The main risk is that the code begins to look less block-like, which is a legit concern, and one that I will ignore for now.

Actually, now that I think about it, metadata won't work at all for things like blocknames, which have embedded typed parameters in them. Or, well, won't work the way I want it to. I'll see what makes sense and go from there. Maybe everything except actual blocks?

And hey, if I move back to implicit names (by position rather than labeled name: at least I will have explored the space more. I think metadata and forms may be a good symbiotic relationship.