I made another compiler (for my custom language)

Remember this project I made a while ago? Yeah, so the new functionality of the Snap! Block AST has got me making compilers in Snap! The very small interpreter was made into this:


And now I can draw a Q with my own language:

enjoy, I guess? and also, whoever came up with the idea for the Snap! Block AST is a genius and needs an award.

What is a Snap! Block AST?

Abstract Syntax Tree.

They mean SPLIT BY BLOCKS and JOIN of a block list.

What we have is actually not an AST because its subtrees don't have nonterminal symbols as their heads. The lists should be something like (SCRIPT ...) where each instr is something like (INSTR ...), each command is (COMMAND ) and each input is (EXPR ...) V (VARIABLE ) V (CONSTANT ).

That would be Jens, of course. But I get a subaward for having spent years bugging him about it! :~)

A lot of work, clearly a labor of love.

But I'm having trouble reading the code, because the CODE block's definition is long and hairy. I wonder if you could have subprocedures named after the command characters, such as a ~ block, a ! block, and so on. Then you can use the JOIN block to turn a block name into a block (in a tree). That would make COMP much shorter because there wouldn't be a zillion IFs in it! Instead there'd just be one RUN block whose input would be JOIN INPUT LIST: (ITEM 1 OF list) ...