M30W - Code Scratch with Scratchblocks!

I'd write a parser in Python on top of Kurt. It might not be a port, though….

Cool! Does that mean it would be better or worse than the one you've been describing?

It needs context though—like variable declarations and stuff. Is that OK?

Kurt certainly has the context, but it might not be available when the parser is invoked.

Currently you can write:

Block("say for secs","hi",Block("*",3,2))

It'd be cool if you could also write:

Block("say 'hi' for 3 * 2 secs")

But a Block doesn't know about it's parent, so doesn't know about things like defined variables. I could always make the parse method a function of Sprite, though, and have sprites keep a reference to the Project (so you can get global variables as well).

Would it be possible to make the context optional? Or is that silly/unworkable?

Kurt already has information on all the blocks (straight from the 1.4/2.0 sources), so you're all sorted there. Have a look at the docs if you like.

M30W - Code Scratch with Scratchblocks!

I'd write a parser in Python on top of Kurt. It might not be a port, though….

Cool! Does that mean it would be better or worse than the one you've been describing?

Better, probably.

It needs context though—like variable declarations and stuff. Is that OK?

Kurt certainly has the context, but it might not be available when the parser is invoked.

Currently you can write:

Block("say for secs","hi",Block("*",3,2))

It'd be cool if you could also write:

Block("say 'hi' for 3 * 2 secs")

But a Block doesn't know about it's parent, so doesn't know about things like defined variables. I could always make the parse method a function of Sprite, though, and have sprites keep a reference to the Project (so you can get global variables as well).

Would it be possible to make the context optional? Or is that silly/unworkable?

It's pretty unworkable. The idea is that you shouldn't need to delimit anything, including string literals. When you write:

say hi for 10 seconds

I don't know if you mean

say [hi] for (10) seconds

or

say (hi) for (10) seconds

unless I know which variables you've declared.

Kurt already has information on all the blocks (straight from the 1.4/2.0 sources), so you're all sorted there. Have a look at the docs if you like.