pocketlang/docs
Thakee Nathees 6a22653263 Minor code enhancements (read bellow)
- Warnings were fixed
- Libraries are registered internally when PKVM created
  and cleanedup when PKVM freed (if PK_NO_LIBS not defined)
- Lang.clock() moved to time module and sleep, epoch time
  were added.
- Support both upper case and lower case hex literals
- Support hex excaped characters inside strings (ex: "\x41")
- Native api for import modules added `pkImportModule(...)`
- pkAllocString, pkDeallocString are changed to pkRealloc.
- NewInstance, DeleteInstance functions now take PKVM however
  delete function should not allocate any memory since it's
  invoked at the GC execution.
2022-05-21 04:15:30 +05:30
..
GettingStarted Minor code enhancements (read bellow) 2022-05-21 04:15:30 +05:30
Reference documentations are refactored 2022-05-07 17:47:58 +05:30
static documentations are refactored 2022-05-07 17:47:58 +05:30
wasm Minor code enhancements (read bellow) 2022-05-21 04:15:30 +05:30
_sidebar.md documentations are refactored 2022-05-07 17:47:58 +05:30
.nojekyll documentations are refactored 2022-05-07 17:47:58 +05:30
404.html documentations are refactored 2022-05-07 17:47:58 +05:30
index.html documentations are refactored 2022-05-07 17:47:58 +05:30
README.md try online page added to docs 2022-05-19 00:13:53 +05:30
tryonline.html try online page added to docs 2022-05-19 00:13:53 +05:30

Pocketlang v0.1.0

Pocketlang is a lightweight & fast object oriented programming language designed for embedding and scripting. Including the compiler, bytecode VM and runtime it's a standalone executable which is less than 300KB and the language itself can be compiled in less than 4s without any external dependencies.


Simplicity is the zen of pocketlang. The syntax is more of an executable pseudocode. Compiling the language itself takes just a single gcc/msvc command. No configuration is required to embed it in another application. pocket VM along with its compiler and standard runtime are a single executable that's less than 300KB. It's not just small but much faster with memory efficient dynamic type system, self adjusting heap for garbage collection, tail call optimization, single pass compilation etc, that makes it compete with main stream langages like python, ruby, wren and lua. And more things that makes pocketlang a swiss knife of programmers.

What it looks like

# 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 10 exclusive.
for i in 0..10
  print("fib($i) = ${fib(i)}")
end

Features

  • No setup. Single binary and your're good to go.
  • REPL
  • Object oriented
  • Dynamic typing
  • Concurrency
  • Garbage collection
  • Operator overloading
  • First class functions
  • Lexical scoping
  • Embeddable
  • Direct interop with C
  • Highly optimized loops
  • Tail call optimization

Getting Started

Note that at the moment there isn't any releases and it's actively being developed. To get your hands dirty clone the source and build it. Compiling the language itself takes just a single gcc/msvc command. See README for more detail.