I made Snap! text-based! (kind of. not really.)


In the midst of other projects on CodingRooms, Thunkable, and Replit, I was bored. Bored and failing to go to sleep. So I dreamt up an idea based on a forum post somewhere- what if there was a Snap! text-based language, like Tosh is to Scratch.

I decided to make that.
Too tired and lazy to make a list of commands, so just check out the single-line block because it has all the commands included.

PLEASE NOTE these text-based blocks don't have things like the pen, sound, control, or list sections because, again, tired. I'll add them later if I figure out how to.

Edit: h why am i so tird its lik not evn nite

You should have made a parser instead. Snap! 6.9.2 Build Your Own Blocks Cool project anyways.

Cute project. All those nested IF/ELSE blocks in SINGLE-LINE RUN give me a headache, though. There are several ways you could avoid that.


and so on.

Second way: "Multi-branched conditional" library.

and so on.

Third way (more effort): data-directed programming. You create a list like this:

Then you write a MATCH block that takes a string like "move () steps" and another string like "move 20 steps" and sees if they match, with "()" in the pattern matching anything in the user's input. When it finds a match, it doesn't just report True; it reports a list of all the input values given by the user. And finally you can just

edit: asking for clarity, what's the connotation of "cute project"?

I have no idea how to do that? Maybe in the future as a challenge. Probably going to multi-branch conditional it instead.

What's a parser?

Your project broke my computer hahahahaha

In computing terms, a parser is supposed to take in information that your program doesn't understand and translate it into information that your program understands.

I remember @programmer_user telling me that my coding software wasn't a coding software at all because it lacked a parser. Then he sent something to me made by repl.it user "CSharpIsGud"

I like it; it embodies a creative idea I would never have thought of; it's not quite at the level of mind-blowing projects (like all the ones Jens invents).

The language (any language) in which you write a program isn't the language that your computer's processor knows how to run. So there has to be software that takes the program you write and translates it into machine language, either as the program is running (an interpreter) or all at once into a file (a compiler). The first thing an interpreter or compiler has to do is transform your program from some bizarre syntax full of semicolons into a syntax tree that's easier to handle than straight program text. That transformation is called parsing the user's program, and the part of the interpreter or compiler that does it is the parser. Like this:

Table view isn't really good for this sort of list. Lines 2 and 3 are the inputs to /. In line 2, columns B and C are sublists for the two inputs to +, namely -b and sqrt(...).