Basic

From Esolang
Jump to navigation Jump to search

Basic is a pseudonatural esolang by Mihai Popa. It transpiles to BASIC!

All commands must start with "This program", like "This program prints". Some words are exceptions.

Commands and words

Basic command list
Basic BASIC Meaning
This program prints [text] PRINT [text] Prints [text]
This program gives user input to [var] INPUT [var] Gives user input to a variable
This program makes a if clause [condition] IF [condition] Makes a IF clause
This program sets a variable, named [var] to [value] LET [var] = [value] Sets a variable to a value
equals / to = Equals (IF) / To (LET)
greater than / is greater than > Is greater than
less than / is less than < Is less than
This program jumps to line 10 GOTO 10 Jumps to line 10
This program makes a else if clause [condition] ELSEIF [condition] Makes a ELSE IF clause
This program makes a else clause ELSE Makes a ELSE clause
This program ends the if clause END IF Ends the IF clause
This program halts END Ends the actual program
then THEN Then
This program remarks the line: REM Marks a single line comment
This program remarks the line (shorter): ' Marks a single line comment

More commands can be done with the translator! Also on Pastebin! (updated later)

Examples

Hello, world!

This program prints "Hello, world!"

XKCD Random Number

This program prints 4

Cat

This program gives user input to cat
This program prints cat

Truth Machine

10 This program remarks the line: Truth Machine (in Basic)
20 This program gives user input to truth
30 This program makes a if clause x is 0 then
40 This program prints 0
50 This program makes a else if clause x is 1 then
60 This program prints 1
70 This program jumps to line 60
80 This program ends the if clause

Implementer

Yes sure! Lingojam!

Here's the link: Basic to BASIC Translator

It also does the reverse (BASIC to Basic)