easylang-web

EasyLang

This is a programming language made in JavaScript for beginners, who want to learn programming basics. It was made for fun so there may be some bugs.

Usage

This repository is actually a web version of this language, so you dont need to install any packages, just go to the domain of the language and code!

Documentation

Variable declaration

variables that can be changed are created with “var”:

var x = 1

constants, in another words variables, that can’t be changed are initialized with a keyword “const”, just like in JavaScript!:

const x = "you cannot change this variable lol"

Data structures

Functions

So functions is very interesting in this language - it can behave like a class

task main(){
  task add(a,b){
    write(a+b)
  }
  task substract(a,b){
    write(a-b)
  }
}

const func = main() //-> runs main, and gets every function and variable in the main
func.add(5,8)
func.substract(67,5)

Or functions can be normal functions:

task helloworld(){
  write("hello world!")
}

helloworld()

Basic binary operations

There are multiple binary operations in EasyLang:

write(2+2)
write(2-2)
write(2*2)
write(2/2)
write(10%3)

Logical binary operations

There are also many logical binary operations in EasyLang:

write(false and true) // -> output must be 0, so false
write(true or 2) // -> output must be 1, so true
write(2<3) // -> output must be 1, so true
write(3<=2) // -> output must be 0, so false
write(10>3) // -> output must be 1, so true
write(3>=3) // -> output must be 1, so true
write(2+2==4) // -> output must be 1, so true

If statements

If statements in EasyLang are very simple -> if keyword, condition, body:

var x = 5
if(x==5){
  write("x is 5!")
}

You can do also if-else statement:

var x = 6
if(x<5){
  write("x is less than 5!")
} else {
  write("x is greater than 5!")
}

Loops

There are two types of loops: quick one and normal

Quick one:

loop(i:10){
  write(i)
}

Normal one:

var i = 0
while(i<10){
  write(i)
  i=i+1
}

Native functions and variables

Thats all, all bugs please report in issues and have fun!:D

Also, huge thanks for Tyler Laceby for his amazing series of videos explaining how parser and interpreter work!