Skip to content
← Back to Community
Announcing Basic Language With Graphics (Beta)
Profile icon
h
has Hacker Plan
amasad

Hey everyone!

I've been working on a classic BASIC language inspired by Microsoft Atari Basic. It comes with a 50x50 display by default and makes it really easy to draw things and make games. The language is still in Beta and I'll be improving it over the coming weeks. For now here is the documentation and a sample snake game that I found on the internet and modified to make it work here. Please let me know what you think.

If you're curious you can find the source code for the interpreter here (https://repl.it/@amasad/pg-basic). Feel free to fix bugs and send patches.

[update] Docs moved here: https://docs.repl.it/misc/basic

[update 2] Changelog:

  • You can now use variables with multiple letters
  • LET is optional. You can define variables like so 10 X = 1
  • TEXT lets you draw text on the screen (refer to docs)
  • Display is now automatically focused after the program is run
  • GETCHAR handles long-presses better

[update 3] Changelog:

  • You can now create multidimensional arrays ARRAY a, 2
  • You can now draw an entire grid with one call DRAW
  • Refer back to docs
Voters
Profile icon
MattDESTROYER
Profile icon
theCaracal
Profile icon
phillipx
Profile icon
JoeSchnetzler
Profile icon
BLyons
Profile icon
KingsleyDockeri
Profile icon
nomorepain
Profile icon
programmeruser
Profile icon
VitalieGhelbert
Profile icon
JosephCanady
Comments
hotnewtop
Profile icon
[deleted]

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration - Edsger W. Dijkstra

Profile icon
Navinor

@TaylorLiang major oof

Profile icon
DynamicSquid

@Warhawk947 agree, big oof

Profile icon
amasad

@TaylorLiang I learned on Basic and I'm still alive!

Dijkstra was a major grump btw

Profile icon
Navinor

@amasad are you sure about that

Profile icon
[deleted]

@amasad just a fun quote i decided to share. Dont completely agree with it. One of my other favorite quotes to share is: "OOP is so bad, that it could have only originated form california"

Profile icon
SixBeeps

@TaylorLiang Okay, so I did some research.
That quote came from the 70's, when BASIC was a lot more different than what we know it to be. There weren't things like GOSUB implemented, so code was often really messy compared to other languages.

Profile icon
[deleted]

Somebodys going to make DOOM in this

Profile icon
CodeSalvageON

@TaylorLiang Knee deep in repl.it

Profile icon
elburg
Profile icon
amasad

FYI: just updated with clearing functions

Profile icon
MrEconomical

uber eats

Profile icon
amasad
Profile icon
MrEconomical

@amasad incredible language! I could never imagine making something as complex as an interpreter. love the old classic BASIC retro feel!

Profile icon
TambiJalouqa

Love this. You brought back so many memories of BASIC but also a chance to re-learn it!

Profile icon
hyperupcall

looks cool! the documentation links appears to be broken though

Profile icon
amasad

@eankeen like what?

Profile icon
hyperupcall

@amasad oh oops, for some reason when you said "for now here is the documentation and a sample snake game" i didn't connect that 'here' means the documentation is 'here on this page', thought it should have been a hyperlink

Profile icon
amasad

@eankeen how nice is it that the whole spec for the language is a single page?

Profile icon
Pygrammar

You know what would be cool; AI for the snake..
Anyways impressive.

Profile icon
Coder100

Yay!
When will TI-basic come out? Will be nice to do maths on repl.it :)

Profile icon
SixBeeps

@Coder100 Oh no

Input N For I,0,N Disp I End
Profile icon
Coder100
Profile icon
HackermonDev

wow

Profile icon
P0GCHAMPB0i

cant you change the size of the grid?

Edit:

Its too tiny :\

Profile icon
BLyons

I learned MS Basic, Apple Basic and Commodore Basic when I was 12 years old. I'm old now and I still love to see basic. Nice job Amjad & Faris!

Profile icon
lynnlo

This is gonna be great.

Profile icon
ChezCoder

If you press D then A it goes straight backwards and kills itself.

Profile icon
TristanMisja

If I were to run the interpreter, which file would I need to execute?

Profile icon
amasad

@TristanMisja basic.js is the main file but you need to instantiate it in index.js

Profile icon
TristanMisja

@amasad Okay, thanks!

Profile icon
Verdinc

Hi, I don't know how else to contact repl.it. I'm new and trying to buy into repl.it if it supports Dart+Flutter for desktop apps (& other platforms later). I need that info and related main help resources.

Profile icon
staticvoidliam7

BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use. The original version was designed by John G. Kemeny and Thomas E. Kurtz and released at Dartmouth College in 1964. They wanted to enable students in fields other than science and mathematics to use computers. At the time, nearly all use of computers required writing custom software, which was something only scientists and mathematicians tended to learn.
In addition to the language itself, Kemeny and Kurtz developed the Dartmouth Time Sharing System (DTSS), which allowed multiple users to edit and run BASIC programs at the same time. This general model became very popular on minicomputer systems like the PDP-11 and Data General Nova in the late 1960s and early 1970s. Hewlett-Packard produced an entire computer line for this method of operation, introducing the HP2000 series in the late 1960s and continuing sales into the 1980s. Many early video games trace their history to one of these versions of BASIC.
The emergence of early microcomputers in the mid-1970s led to the development of the original Microsoft BASIC in 1975. Due to the tiny main memory available on these machines, often 4 kB, a variety of Tiny BASIC dialects was also created. BASIC was available for almost any system of the era, and naturally became the de facto programming language for the home computer systems that emerged in the late 1970s. These machines almost always had a BASIC interpreter installed by default, often in the machine's firmware or sometimes on a ROM cartridge.
BASIC fell from use during the later 1980s as newer machines with far greater capabilities came to market and other programming languages (such as Pascal and C) became tenable. In 1991, Microsoft released Visual Basic, combining a greatly updated version of BASIC with a visual forms builder. This reignited use of the language and "VB" remains a major programming language in the form of VB.NET.

Profile icon
amasad

@LiamDonohue Thanks for sharing

Profile icon
LoganSpong

@amasad Pretty sure thats a copy from wikipedia

Profile icon
staticvoidliam7

it is lol @LoganSpong

Profile icon
staticvoidliam7

request: add Visual Basic

Profile icon
staticvoidliam7

also, is this your personal project?

Profile icon
amasad

@LiamDonohue sorta. I mostly work on it on the weekend.

Profile icon
[deleted]

You say it comes in a 50x50 display "by default". Does this mean we can change the size of the display?

Profile icon
amasad

@roylatgnail we were thinking about that. It's easy to add. What would you want it for?

Profile icon
[deleted]

@amasad It would be nice for making art, and games. You could programmatically (for example) limit the size or increase the size of the snake game for increased or added difficulty

Profile icon
21natzil

Feature request: Either let us set multiple variables on one line or bitwise operations

Profile icon
amasad

@21natzil how are these features related?

Profile icon
21natzil

@amasad I could use the AND bitwise operation to extract numbers from one big number, but that's a very hacky way :P

Profile icon
xxpertHacker

Although many may not fully agree with me, it has always seemed redundant to put parenthesis when calling a parameter-less function, so, since your making the language, can you change this, or are you trying to properly emulate BASIC? The only language I've seen do this is PineCone.
https://pinecone-lang.herokuapp.com

Also... do you support user-defined functions yet?

Profile icon
amasad

@StudentFires I'm not a big fan of optional syntax because it makes it hard for newbies to know when to use it or when to not use it. The more you add options to a language the harder it is to learn, I think.

Profile icon
xxpertHacker

@amasad Yeah I thought you'd say something like that, but what about the second part of my question on user-defined functions?

Profile icon
[deleted]

@StudentFires oooh, pinecone. Finally somebody else that knows pinecone

Profile icon
[deleted]

@roylatgnail Does Pinecone really not require parenthesis if a function lascks parameters!?

Profile icon
[deleted]

How do you change a variable?

Profile icon
amasad

@CodeABC123 You can use LET again. But I'm thinking of dropping LET altogether and letting you assign a variable without it -- what do you think?

Profile icon
LegoLiam

I think yes please respond im trying to figure out how to change a variable in a list so that what the variable is
= to will be in list and i need to be able to update while running. Ps: im using python @amasad

Profile icon
[deleted]

Cool!

Profile icon
SixBeeps

If we want to make modifications, how do we send them in?

Profile icon
amasad

@SixBeeps Until @turbio implements "merge request" I guess GitHub is the easiest thing. The repo is here: https://github.com/amasad/pg-basic

Profile icon
SixBeeps

@amasad Ah, thanks.

Profile icon
xxpertHacker

Came back and re-looked through the language tutorial you made, then I noticed the following:

CLS
CLS clears the console and the display.

CLC
CLC clears the console and the display.

Should CLC clear the display?

Also, this is an interpreted language, not a compiled language, right?

Profile icon
amasad

@StudentFires Fixed. And yes it is interpreted but it does something like compiling which is it translates basic expression to javascript on the fly. Out of laziness mostly but it's also faster.

Profile icon
Viper2211

Cool!

Profile icon
JackFly26

10PRINT time

Profile icon
Navinor

Aight guys lets make fortnite

Profile icon
TheDrone7

Could you use QB64 as the BASIC compiler instead please.

Profile icon
amasad

@TheDrone7 if you write or find a good JavaScript compiler I will add it (the one we have now has a lot that's missing)

Profile icon
TheDrone7

Will do. @amasad

Profile icon
[deleted]

@amasad why javascript?

Profile icon
TheDrone7

Can you share the current [email protected] I'll try adding to it.

Profile icon
Coder100

JavaScript is superior @TaylorLiang

Profile icon
[deleted]

@Coder100 c++ is faster

Profile icon
amasad

@TheDrone7 I put it in the post above https://repl.it/@amasad/pg-basic

Profile icon
TheDrone7

Oh, thank you. I'll see what I can do. @amasad

Profile icon
TheDrone7

@amasad I almost gave up on working on it after seeing you write tests for everything.

Profile icon
xxpertHacker

@amasad So, since this was done in JavaScript, I thought It wouldn't be irrelevant to point out that Repl's NodeJs is more outdated than my browser. Can you guys update it, or better yet set, up an automated update script? I've been trying to try out the newest JavaScript features.

Profile icon
TheDrone7

Node.js in general has always been behind browser js iirc, you can still use the latest node js version by simply adding node to your package list. @StudentFires

Profile icon
xxpertHacker

@TheDrone7 How do I do that?

Profile icon
TheDrone7

Just search for node in the package manager and add it. @StudentFires

Profile icon
xxpertHacker

@TheDrone7 How do I search the package manager? Lol, sorry I'm pretty new to Node and NPM.

Profile icon
TheDrone7

I'm talking about the repl.it package manager. Node and npm can be confusing for beginners so repl.it provides a gui package manager. click on my profile and see my posts, you'll find a introduction to the repl.it editor post. Thay will give a quick overview of the repl.it editor. @StudentFires

Profile icon
xxpertHacker

@TheDrone7 But still... wouldn't it be better if Node was already updated, for everyone who uses Repl.it?

Profile icon
xxpertHacker

@TheDrone7 Hmm, I can't get it to work, I added node 13.12.0, but literally nothing changed. My code still failed. The package.json updated though.

Profile icon
TheDrone7
  1. It'll obviously be better if node is updated by default but we always have workarounds until they actually do it. Me and a few other members of the replit discord have constantly been bugging the replit team about this but they do have other more important issues to fix and features to add.
  2. That is weird, repl.it normally installs all dependencies before running so it should not fail. You can try creating a file named exactly .replit with the contents: -
language = "nodejs" run = "npm i && node index.js"

If it still doesn't, then there is an error in your code.
@StudentFires

Profile icon
xxpertHacker

@TheDrone7 Hmm, why are we running what's npm i, everything els, from the .replit to && isn't new to me.

Profile icon
xxpertHacker

@TheDrone7 Uhh, update: My repl was bugged, it didn't save anything past a certain point, it happens to me every once in a while. I'll realize it's not running my current code, but an outdated version, once I spot it, I try to copy my current code because Repl isn't saving an acknowledging my updates. This has resulted in severe data loss before. Also, the Repl crashed.

Profile icon
TheDrone7
  1. npm i is short for npm install which basically reads all packages from your package.json file and installs them. && basically indicates the part after it should be executed after the command before it has finished executing. .replit are special replit files for custom commands and stuff.
  2. [email protected]
Profile icon
CodingCactus

Really cool, I feel like your example for the ATAN is wrong (typo), it says:

10 PRINT TAN(1)

Should it say?:

10 PRINT ATAN(1)

Also, I'm confused about the ASC one, if you write:

10 PRINT "s"

It gives out 115. Why doesn't it just print: s ?

Also, it says in the lowercase section

10 PRINT UPPERCASE("BASIC")

will print "basic", is this a typo? should it be LOWERCASE("BASIC")?

Anyway, this looks really cool Well done!

Profile icon
[deleted]

@CodingCactus the reason 10 PRINT "s" prints out 115 is because that is the ASCII code for s.

Profile icon
CodingCactus

@sugarfi so why does 10 PRINT "hello" print hello and 10 PRINT "s" print 115
surely they are the same thing?

Profile icon
amasad

@CodingCactus fixed typos. Thanks!

Profile icon
CodingCactus

@amasad oh, ok. Thanks

Profile icon
[deleted]

@CodingCactus not really. hello is more than one character, so it doesn't have one single ASCII value. s, on the other hand, has one value and so that is printed.

Profile icon
CodingCactus

@sugarfi It was just a typo, it was supposed to be 10 PRINT ASC("s")

Profile icon
[deleted]

@CodingCactus ok. just out of curiosity, how do you know it was a typo? Is the source for this implementation available somewhere?

Profile icon
CodingCactus

@sugarfi look at the ASC section now, it has been changed

Profile icon
[deleted]

@CodingCactus oh, cool

Profile icon
xxpertHacker

@CodingCactus Does it support Unicode? Can I assign a variable a number with a decimal point?

Profile icon
amasad

@StudentFires yes and yes.

Profile icon
xxpertHacker

@amasad Does ASC() work with Unicode characters?

Profile icon
amasad

@StudentFires yes. I guess that makes the name kind of silly but it relies on JavaScript strings.

Profile icon
xxpertHacker

@amasad Okay. Good luck with the language!

Profile icon
amasad

@StudentFires thanks. Are you going to try it?

Profile icon
staticvoidliam7

is this THE BASIC? as in Beginners' All-purpose Symbolic Instruction Code?

Profile icon
amasad

@LiamDonohue that's right

Profile icon
staticvoidliam7

Alright ima go learn basic @amasad