esolang

command module
v0.0.0-...-726609c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

README

ESOlang

This is a programming language made for fun as well to practice more the GO programming language. I call it Esoteric programming language but it actually is not, is pretty much like functional javascript with support for first class functions. Currectly there is no variables, only constants.

Features

The language currently supports

  • string data type
  • int data type
  • functions data type (including first class)
  • array data structure and method to pop, push and get length
  • hashmap data structure
  • conditionals
  • closures
Installation

Prerequisites:

  • Having GO version 1.19 already installed
  • Having git already installed.

Run the following commands

  • git clone https://github.com/carepollo/esolang.git
  • cd esolang
  • go build main.go
  • This step depends on your OS. On Linux or MacOS should be: ./esolang
  • On Windows maybe is going through folder and open the .exe
How to use
Hello world
puts("Hello World!");
Variables
let message = "Hello World!";
let number = 1;
Arrays
let array = [1, 2, 3];
array[0] = 2;
push(array, 1); // add value
rest(array); // elements starting by index 1
len(array); // amount of elements
HashMaps
let hashmap = {"a": 1, "b": 2};
hashmap["a"] = 2;
Functions
let myfunc = fn(a, b){ a + b }
let afunc = fn(){ return myfunc }
afunc()()

Supports implicit and explicit return

Conditionals
if (true) {
    puts(1);
}
if (false) {
    puts("nothing");
} else {
    puts("something");
}
Sidenote

In case you wonder why is called 'esolang' to begin with, is because it all started from an idea that was discard afterwards, it was merely shitpost so it not worth mentioning.

Benchmark

You can make a simple comparison between the interpreter and compiler of this language running the following commands.

go build -o fibonacci ./benchmark
./fibonacci -engine=eval && ./fibonacci -engine=vm

Here is the output on my Machine (the bottom is the compiled one) benchmark

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL