Esolang is a beginner friendly dynamically typed scripting language for quick prototyping and learning functional programming.

Installation

go get github.com/ahmedsaheed/esolang

or via homebrew

brew tap ahmedsaheed/esolang
brew install esolang

Usage

Try it out now in a sandbox environment on your browser via the esolang playground.

Eso Expressions can evaluated on your terminal using the built-in repl by running the command esolang -repl or via a file on your preferred text editor with the .eso extension and running the command esolang -file <filename>.

Overview

PageDescription
Language OverviewOverview of the esolang syntax & semantics
ExamplesCode samples in esolang
InternalsOverview of the inner workings of esolang
Built-in FunctionsList of built-in functions in esolang

Inspiration

This scripting language draws its core concepts from the aclaimed works of Thorson Ball’s (Writing an Interpreter in Go), Bob Nystrom (Crafting Interpretes), and the foundational SICP.

To make the language more approachable it borrows familiar concepts from popular languages like JavaScript, Golang, Ocaml as well as basic arithmetics principals

List of features

FeaturesInsprationDescription
Variable BindingsOcaml & JSVariable bindings are done using let keyword
ConditionalsC-Family, GolangConditionals are done using if keyword
LoopsC-Family, GolangLoops are done using while keyword
ArraysJavaScriptEasy initialiasation of dictionary using [] or array_new()
HashJavaScriptA key value pair data structure student = {"name": "John Doe"}
Function LiteralsGolangFunction literals are done using fn keyword
Higher Order FunctionsJavaScriptHigher order functions are done using fn keyword
ClosuresGolangClosures are done using fn keyword
Error MessagesRustRigid error messages
Tons of built-in functionsGolangBattries includes functions to get you up an running ASAP

Performance

The performance could be improved. At current its mediocre. Evaluation stage seems to be hindering speed as its a recursive decent which traverses each AST node and interprets what its sees. Bytecode compilation solution which runs on a VM would improve the performance significantly.

Current benchmark of fib(20) using hyperfine is as follows

hyperfine 'esolang.go ./benchmarkings/bench.eso' 'python3 ./benchmarkings/bench.py'
CommandMean [ms]Min [ms]Max [ms]Relative
esolang ./benchmarkings/bench.eso14.6 ± 1.514.028.41.00
python3 ./benchmarkings/bench.py22.3 ± 3.821.150.11.52 ± 0.30