I made a custom programming language based on BASIC

The title's is kinda lying but it doesn't matter because it's still inspired by BASIC.
The variation of BASIC this was inspired by was BlitzBASIC. You know, the language used to power SCP: Containment Breach and SCP-087-B?

This is the sequel to this thread: I made a story using the Menus library

Story Builder script pic (3)

The compiler is in chunks (the chunks being blocks) so you can actually read the compiler.

The reason this was built was that Snap! was lagging really hard whenever I moved around in the block editor (most likely because the entire project was in the Stage and the stage had lots and lots of blocks in it)

It seems like Snap! can handle text better than the number of blocks that I had in the block editor. So, I made this.

To add a comment use ; on a line. Currently, comments cannot be on lines with commands.
There is no multiline comment symbol like in JavaScript.

COMMANDS:

All the commands must be in uppercase for the compiler to understand what your telling it to do.

A String from here on out is text in double-quotes. If you've ever used a programming language before you know what a string is.

SUB — Think of it as the start of a function or the Sub from VBScript. Must be a string following it.

END — Ends a Sub/Function or an IfVar statement.

IFVAR — Checks if a variable is equal, greater, less, or not equal to a constant or a variable. ex:


Variables MUST be in double quotes because variable names can have spaces.
Operators: ==, !=, <=, >=, >, <
The purpose of this command is to add different story routes if you so do please.

JUMP — Quite literally JUMPS to the sub provided. This command must be preceding a string. Nothing can run after this statement.

CALL — Runs the sub provided. This command must be preceding a string. Returns to where it left off when the sub is finished.

WAIT — Waits for the specified amount of time (in seconds). (ex: WAIT 5)

PLAYSND — Plays the sound provided it exists in the current context. (that being the context it was built in). A string must come after this command.

BROADCAST — It does exactly what the broadcast block does. Must be preceding a string. If you put AND WAIT after the name of the broadcast it will wait for all of the receivers to finish before moving on.

The commands that handle the story:

PUSHMSG — Putting either LEFT or RIGHT after this command will determine where the message is placed. After putting the placement of said message the message must come in the form of a string. If you would like you can put AND CHOOSE after the message to save time.
General Syntax:
PUSHMSG LEFT "Hello World"
PUSHMSG LEFT "Hello World" AND CHOOSE

CHOOSE — Shows the GUI asking for the user to choose an option. This needs to be called after pushing the choices onto the choice list. The command below will do that for you.

PUSHCHOICE — Adds a choice for the user to choose. This must be preceding a string. After specifying the choice the numeric ID must also be given, or you could just put SEED for it to randomly generate one for you.
General Syntax:
PUSHCHOICE "good afternoon" 0
PUSHCHOICE "good afternoon" SEED

SETTITLE — Sets the title for the story. Must be preceded by a string.

UPDATE 1.1:

ELSE — Think of ELSE in an IF/ELSE block.

UPDATE 1.3:

DECL — Declares a variable in the specified scope.

LET — The block below:
the let block
This declares a variable in the scope that the statement was declared in.

SET — Think of the SET block in Snap!

Comments on lines with commands are supported. Everything after a ; gets ignored.

Commands will be added for more functionality.
Enjoy the block I suppose.

The Project: Snap! Build Your Own Blocks

Thank you @bh for bugging Jens to put the Snap! "Block AST" (is there an official name for this yet?) into Snap!

Also, if you think this language can't do much more, remember the phrase "you can do a lot with a little"

nice.

you should add an ELIFVAR block
(like elif in python)

that's possible by default:

IFVAR "choice" == CONST 1 THEN
    ; do stuff.
ELSE
    IFVAR "choice" == CONST 2 THEN
        ; other stuff.
    ELSE
        ; stuff.
    ENDIF
ENDIF

but it would be easier to just type

ELIFVAR "choice" == CONST 2 THEN

than

ELSE
    IFVAR "choice" == CONST 2 THEN

Try to make ASM now. I dare you

This is a remarkable project. I haven't read the code yet (scared off by your comment about it) but it accomplishes a lot.

I don't understand how SEED is useful, maybe because I don't fully understand what those numbers are for. I'm guessing that the number is used to represent the choice later in the program, but if so, I don't see how it can be useful to have a random choice number that the programmer doesn't know!

Actually, you can read the code of THIS compiler, somewhat.
I forgot to remove that part from the topic when I decided it was time to redesign the compiler.
It was originally just IFs now it's in different blocks.

(also thanks for the feedback on the last compiler! I actually redesigned the compiler with that idea!)

Hi, I'm sorry I haven't gotten to this, but I haven't forgotten. :~/

This is super cool! Can I use this (tokens) for more inspiration for my own language based on basic that I’ve been working on?

sure.