Skip to content

Dsackler/lemonScript

Repository files navigation

lemonScript

Logo

Introduction

One morning, a young Khalid awoke and decided to finish his A.I assignment. “Gosh, I just hate python more than life itself” he muttered as he typed with a sour face. At that moment, he looked at the lemon pulp he has been collecting for the past 5 years due to his midnight lemon snack addiction. At that moment, he decided to call his much smarter and superior friend David to write him a language that everyone could enjoy. So, David formed a team with Brent, Julian, Justin, Raul, and Khalid with the intent to create a language for all lemon enthusiasts. The stage has been set. lemonScript was to be a self-explanatory, statically-typed, esoteric language with the sole purpose of saving people who had a sour taste in their mouth from using popular languages.

Brought to you by: Julian Arregoces,Raul Rodriguez, Brent Shafer, Justin Yee, David Sackler, Khalid Alghunaim

If you would like to learn more about lemonScript you can visit our official website: https://dsackler.github.io/lemonScript/

Features

  • Statically typed language
  • Static scoping!
  • Switch statements using keywords pick()
  • Easily defined blocks of code seperated by the words BEGIN JUICING and END JUICING
  • Declare functions with "When life gives you lemons try (return type) name()"
  • Single line comments with ( *)
  • Multiple line comments with ( *) (* )
  • AND SO MUCH MORE TASTY FEATURES ITS A BITTER PILL TO SWALLOW TO LET GO OF THE FAMOUS PYTHON, BUT GIVE LEMONSCRIPT A TRY! ITS REFRESHING!

Types

JavaScript lemonScript
String pulp
Number slice (for integers) or dontUseMeForEyeDrops (for floats)
Boolean taste
const lemonStain

Types of Static Semantic Errors

  • Type mismatch
  • Assignment to constant variable
  • Continue/Break can only be used in a loop
  • Number of arguments when calling a function
  • Arguments passed into a function has the correct types
  • Is callable
  • Returns something
  • Returns nothing
  • The return type is correct
  • Not inside a function
  • Is a number
  • Is an integer
  • Is a boolean
  • Is an array
  • Is a dictionary
  • All elements in an array has the same type
  • All keys are unique
  • Keys and Values have the correct type

Variable Declaration and Assignment

JavaScript lemonScript
let x = 10; slice x = 10
let y = "Lemons are great"; pulp y = "Lemons are great"
let z = 4.20; dontUseMeForEyeDrops z = 4.20
let a = true; taste a = sweet
const c = "blue"; lemonStain pulp c = "blue"

Built In Functions

lemonScript

JavaScript

pour(“Hello World”)
console.log("Hello, World!");

Function Declarations

lemonScript

JavaScript

When life gives you lemons try (return type) *name*() BEGIN JUICING statements END JUICING function name([param[, param,[..., param]]]) { [statements] }

Comments

JavaScript lemonScript
//this is a single line comment ( *)this is a comment
/*this is a multi-line comment ( *)this is a multi-comment(* )

Arithmetic

  • sum = 2 + 4
  • difference = 2 - 4
  • multiplication = 2 * 4
  • division = 4 / 2
  • exponents = 4 ^ 2 *note we can change this to ** or something else
  • modulus = 4 % 2

A guide to lemonscript's keywords

JavaScript lemonScript
boolean taste
break chop
case lemonCase
const lemonStain
constructor plant
continue nextLemon
default citrusLimon
else Toss the lemon and do
else if Keep juicing if
extends branches
false sour
for forEachLemon
function When life gives you lemons try (return type) name() BEGIN
if Squeeze the lemon if
new seed
return you get lemonade and ...
static trunk
switch Pick ()
true sweet
typeof species
void noLemon
while Drink the lemonade while
class Limon
import receive

Control Flow

Programming Feature

lemonScript

JavaScript

If/Else
Squeeze the lemon if(x == 10)
	BEGIN JUICING
	pour(“Number is 10”)
	END JUICING
	
Keep juicing if(x == 20)
	BEGIN JUICING
	pour(“Number is 10”)
	END JUICING

Toss the lemon and do
	BEGIN JUICING
	pour(“Number is not 10 or 20”)
	END JUICING
	if (x == 10) {
		console.log(“Number is 10)
	} else if (x == 20) {
		console.log(“Number is 20)
	} else {
		console.log(“Number is not 10 or 20)
	}
For Loops
forEachLemon (slice i = 0; i < 5; i++)
	BEGIN JUICING
	pour(“Number: ” + i)
	END JUICING
for (i = 0; i < 5; i++) {
	console.log(“Number:  + i)
}
While Loops
Drink the lemonade while (x > 0) 
	BEGIN JUICING
	pour(x)
	x--
	END JUICING
while (x > 0) {
	console.log(x)
	x--
}

Example Programs

Hello World

lemonScript

JavaScript

When life gives you lemons try noLemon helloWorld()
	BEGIN JUICING
	pour(“Hello World”)
	END JUICING
function helloWorld() {
	console.log(“Hello World”)
}

Adding Two Numbers

lemonScript

JavaScript

When life gives you lemons try slice add(slice a, slice b)
	BEGIN JUICING
	you get lemonade and a + b
	END JUICING
function add(a, b) {
	return a + b
}

Switch Statements

lemonScript

JavaScript

slice even = 4
pulp twofoursixeight
Pick (even)
  BEGIN JUICING
  lemonCase 2
    twofoursix = "two"
    chop
  lemonCase 4
    twofoursix = "four"
    chop
  lemonCase 6
    twofoursix = "six"
    chop
  citrusLimon
    twofoursix = "eight"
  END JUICING
pour(“Our result is ” + twofoursix)
let even = 4;
let twofoursixeight;
switch (even) {
  case 2:
    twofoursix = "two";
    break;
  case 4:
    twofoursix = "four";
    break;
  case 6:
    twofoursix = "six";
    break;
  default:
    twofoursix = "Eight";
}

console.log(“Our result is  + twofoursix);

Nth Fibonacci

lemonScript

JavaScript

When life gives you lemons try slice fibonacci(slice num)
	BEGIN JUICING
	Squeeze the lemon if(num == 0)
	  BEGIN JUICING
	  you get lemonade and 0
	  END JUICING
	Squeeze the lemon if(num == 1 || num == 2)
	  BEGIN JUICING
	  you get lemonade and 1
	  END JUICING
	you get lemonade and fibonacci(num - 2) + fibonacci(num - 1)
	END JUICING
function fibonacci(num){
  if(num == 0){
    return 0;
  }
  if(num == 1 || num == 2){
    return 1
  }
  return fibonacci(num - 2) + fibonacci(num - 1)
}

Class Example

lemonScript

JavaScript

Limon Car
BEGIN JUICING

	plant(pulp name ,slice year)
		BEGIN JUICING
		thisLemon.name = name
		thisLemon.year = year
		END JUICING


	When life gives you lemons try slice getYear()
		BEGIN JUICING
		you get lemonade and thisLemon.year
		END JUICING

END JUICING

Car myCar = seed Car("Ford",2014)

Limon Ferrari branches Car
BEGIN JUICING
    	plant(slice year)
		BEGIN JUICING
		thisLemon.name = "F8 Spider"
		thisLemon.year = year
		END JUICING
END JUICING
class Car {
  constructor(name, year) {
    this.name = name;
    this.year = year;
  }

  getYear(){
	  return this.year
  }
}

myCar = new Car("Ford", 2014);


class Ferrari extends Car {
	constructor(year) {
		this.name = "F8 Spider";
		this.year = year;
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published