mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-05 20:26:53 +08:00
A lightweight, fast embeddable scripting language.
1d2d88fa7a
generated files only remain in docs/ branch |
||
---|---|---|
cli | ||
docs | ||
src | ||
test | ||
.gitignore | ||
LICENSE | ||
README.md | ||
SConstruct |
PocketLang
PocketLang is a simple and fast programming language written in C. It's syntactically similar to Ruby and it can be learned in less than an hour. Including the compiler, bytecode VM and runtime, it's a standalone executable with zero external dependecies just as it's self descriptive name. The pocketlang VM can be embedded in another hosting program very easily, as static/shared library or a generated single header version of the source, which makes it even effortless.
The language is written using Wren Language and their wonderful book craftinginterpreters as a reference.
What PocketLang looks like
# Python like import statement.
from os import clock as now
# A recursive fibonacci function.
def fib(n)
if n < 2 then return n end
return fib(n-1) + fib(n-2)
end
# Prints all fibonacci from 0 to 100 exclusive.
for i in 0..100
print("fib(%) ="%i, fib(i))
end