Is there a text syntax for Snap?

I have not seen one anywhere. If not, does anyone else think it is worth having one e.g. Scheme? I realize things like Snap's flexible mix-fix syntax might not carry across cleanly.

Umm if you open the gear menu, choose "fade blocks," and set the slider to 100, you get Snap! text syntax, sort of.

I've been known to translate to Scheme syntax for explaining things about Snap! to Scheme people, but in a way our syntax is closer to Smalltalk, which is understandable given the history of Scratch.

But, what application did you have in mind?

(a) Easier to post, email, discuss
(b) Take a great FP library from Elm. Mechanically translate most of it to Snap like this

Hmm. On point (a), that's what I always say about the idiotic use of indentation to mean nesting of control structures in Python -- try running that through your email client and see what happens. But everybody else tells me that you don't put program code in the text of your message; you attach it as a file.

I find Snap! code easier to read than text language code, even Scheme. The shapes and colors of the blocks are like explanatory comments in the code, but without the clutter. And any translation of anything introduces the possibility of mistranslation.

Point (b) is more interesting, but notation is the least of the difficulties, I think; more important is that the semantics of the two languages will differ in subtle ways.

But this has been done, by Tim Radvan., a long time ago, translating between saved Scratch projects and, iirc, Python, both ways.

So, yeah, the de facto text equivalent of a Snap! program is the XML representation you get when you export a project. It's theoretically possible to parse that and translate it into your favorite text language.

And of course there's the codification feature. If you don't know about that, go to File>Open>Examples>Codification.

Thanks, Brian

You can also turn on keyboard coding.

Yep. Python<->Scratch library in Python, called "kurt".

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.