A new BASIC programming language

I, like many other programmers, first learned to write computer code with some variation of BASIC. To be precise - I wrote my first programs in TI-Basic during algebra class and then graduated onto Visual Basic my freshman year of high school. I found QBASIC somewhere in the midst of that before moving onto Python.

It's weird to me that a lot people learn what I believe to be much harder programming languages. JavaScript, while ubiquitous, has at least 4 ways to make a new function and as many ways to define a new variable. Bring in pattern-matching, and suddenly it's tough to keep track of all the braces.

So, I'd like to bring BASIC back (though, to be fair, it never actually left).

https://github.com/jdan/basic2020

FUNCTION factorial(N)
  IF N = 1
    RETURN 1
  ELSE
    RETURN N * factorial (N - 1)
  END
END

PRINT(FACTORIAL(20))

I want a language with incredibly Simple syntax and the ability to quickly and natively create Command-line programs, Drawing programs and Web programs.

Later on, I want to allow others to make different types of program templates (for things outside of command-line and web that I haven't thought about!) and Editor integrations.

Referenced in:
Jot
This is where I collect my thoughts. Inspired by Andy Matuschak and, in some ways, the Zettelkasten - I jot down my thoughts and make no attempt to index them. There is no list of recent posts. They are only discoverable when they are linked to and from. Here is what I'm currently working on / thinking about: A new BASIC programming language Incremental progress Building jot Authoring notes This collection contains {notes} notes linked together {links} times with {words} total words.

Simple syntax

The complete grammar can be found on GitHub

variables

X <- 10
Y <- X + 5

control flow

IF X - Y > 0
  MAX <- X
ELSE
  MAX <- Y
END

functions

FUNCTION factorial(N)
  IF N = 1
    RETURN 1
  ELSE
    RETURN N * factorial (N - 1)
  END
END

Command-line programs

The Preamble with contain:

COMMAND LINE PROGRAM

PRINT

PRINT "Hello, world!"

INPUT

X <- INPUT
Y <- INPUT "Enter your age:"

MENU

MENU [
  "Enter a new student" ENTER_STUDENT
  "Change a student" MODIFY_STUDENT
  "Help" DISPLAY_HELP
]

KEYBOARD CONTROLS

Editor integrations

I've begun adding syntax highlighting

But... wow this is hard stuff.

{
  "match": "\\b([A-Za-z][A-Za-z0-9\\$_]*)\\s*(<-)",
  "captures": {
    "0": {
      "name": "variable.basic2020"
    },
    "1": {
      "name": "keyword.operator.assignment.basic2020"
    }
  }
}

I've been using Microsoft's JavaScript.tmLanguage as inspiration and it is hard to comprehend that this is the best way to do this.