HELP NEEDED WITH CREATING A LANGUAGE!
@CoderCactus Hey, can you check this out?
This post is being bot upvoted by new, 0 cycle accounts.
I think just reading the names of these accounts is enough to show that these are bots, especially considering how the last two are similiar in more than just username.
I was going to report this, but the report box has a size limit of 0xFF chars :/
A) Validate the input, if it's invalid, throw an exception.
B) Validate the output, if the output isn't valid JS, throw an exception.
Regarding (B), if your output is incorrect, I'd consider it to be a compiler error, parse correctly and this won't happen.
@AJK4 Btw, I'd recommend using Coder100's answer, and using a parsing/lexing library instead of RegEx. You don't have to reinvent the wheel and parse by hand (it may even slow you down in fact), but ECMAScript RegEx won't help, recursive RegEx would be better, ex: PCRE syntax, but JS doesn't have anything else.
Just try to get a better parser that can stop when something isn't correct, so you can handle it yourself, or throw an error and abort the program.