• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    C
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight, embeddable scripting language
         _
 ___ ___| |
/ __|_  / |
\__ \/ /| |
|___/___|_|

Overview
========

szl is a tiny, embeddable scripting engine inspired by Tcl and shell. It's a
balanced mix of their key features: szl combines the simplicity of shell
scripting with the power of a dynamic, Tcl-like type system, minimalistic
syntax and programming language features missing in the shell, like exceptions
and OOP.

szl comes with a rich standard library that includes bindings for
permissively-licensed libraries. Therefore, it can run processes, parse text
with transparent Unicode support, manipulate data structures like dictionaries,
operate on binary data, interface with C code through scripts, multiplex
non-blocking I/O at scale, call REST APIs and much more, at a fraction of the
memory and size footprint of other scripting languages, while achieving
reasonable efficiency.

szl can be used both as a standalone (either interactive or non-interactive)
interpreter or as an integral part of other projects, via the libszl library. In
addition, the feature set and behavior of szl can be easily fine-tuned to meet
the size and memory consumption limitations under various usage scenarios and
hardware platforms.
   ___________________________________
  /                                   \
  | >>> $global msg {Hello, world!}   |
  | Hello, world!                     |
  | >>> $load zlib                    |
  | >>> $zlib.crc32 $msg              |
  | 3957769958                        |
  | >>> [$exec {uname -s}] read       |
  | Linux                             |
  | >>> [$open /bin/gunzip rb] read 9 |
  | #!/bin/sh                         |
  | >>> $map i [$range 1 4] {$+ $i 3} |
  | 4 5 6                             |
  \___________________________________/

For more information, see the user manual at http://dimakrasner.com/szl.

Building
========

On Debian (http://www.debian.org) based distributions:

  $ apt-get install git gcc meson zlib1g-dev libcurl4-gnutls-dev libarchive-dev
                    libssl-dev libffi-dev

Then:

  $ git clone --recursive https://github.com/dimkr/szl
  $ cd szl
  $ meson build
  $ cd build
  $ ninja
  $ ninja install

By default, szl is built with core functionality built-in to the interpreter,
while a big part of the standard library resides in dynamically-loaded shared
objects. This way, the memory consumption of szl scripts that don't use the
entire standard library is lower.

However, in some use cases (for example, when szl is embedded into another
project), this is undesirable.

To build szl as a single executable file, with all extensions linked statically
into the interpreter:

  $ mesonconf -Dbuiltin_all=true

In addition, built-in extensions can be chosen individually, e.g.:

  $ mesonconf -Dwith_curl=builtin -Dwith_ffi=no

Embedding
=========

To embed szl into other projects, use the API defined in szl.h and link with
libszl.

The size and performance of szl can be tuned using advanced build options:

  $ mesonconf -Duse_int=true

This build option replaces the large integer type used by szl to represent
integers, to the standard C int. This may improve performance under platforms
without native support for 64 bit integers, at the cost of a limited range of
valid integer values.

  $ mesonconf -Duse_float=false

This build option changes the precision of floating-point numbers in szl from
double to single precision. This may improve performance under platforms without
native support for double-precision floating point numbers, at the cost of
precision.

  $ mesonconf -Dwith_float=false

This build options disables support for floating-point arithmetic. This reduces
szl's size.

  $ mesonconf -Dwith_unicode=false

This build options disables support for Unicode strings and cancels szl's
internal distinction between encoded byte strings and arrays of Unicode code
points. This reduces szl's size and may improve performance with zero side
effects, if szl is guaranteed not to perform any sort of Unicode string slicing.

Security
========

Support for dynamic loading of szl extensions can be disabled:

  $ mesonconf -Dwith_dl=false

When dynamic loading is disabled, szl will refuse to load extensions, unless
they are linked statically into the interpreter.

This way, a szl interpreter embedded into another program does not make it
vulnerable to dynamic loader hijacking (e.g. LD_LIBRARY_PATH) during extension
loading.

Running
=======

To run an interactive interpreter:

  $ szlsh

Or, to run a script:

  $ szl $path

Or, to run a one-liner:

  $ szl -c $snippet

Credits and Legal Information
=============================

szl is free and unencumbered software released under the terms of the MIT
license; see COPYING for the license text. For a list of its authors and
contributors, see AUTHORS.

The ASCII art logo at the top was made using FIGlet (http://www.figlet.org/).

More Repositories

1

nss-tls

A DNS over HTTPS resolver for glibc
C
142
star
2

loksh

A Linux port of OpenBSD's ksh
C
116
star
3

tootik

A federated nanoblogging service with a Gemini frontend.
Go
98
star
4

rlsd

A lightweight, retro Linux-libre distro
Shell
72
star
5

shus

A tiny HTTP server for static sites
C
71
star
6

tty8

A suckless terminal multiplexer
C
41
star
7

papaw

A simple, decompressing executable packer
C
39
star
8

rlsd2

A minimalistic GNU/Linux-libre distro
Shell
37
star
9

LoginKit

A standalone logind shim - GitHub mirror
C
32
star
10

luufs

Lazy man's, user-mode union file system
C
30
star
11

pylzfse

Python bindings for LZFSE
C
29
star
12

libwaive

A library that allows processes to waive their rights
C
27
star
13

lazy-utils

A collection of tiny, permissively-licensed Linux system tools; deprecated in favor of sdaemons
C
25
star
14

dohli

Set up your own ad-blocking DoH server
Go
21
star
15

sdaemons

Suckless daemons
C
19
star
16

codile

A web-based IDE
TypeScript
19
star
17

nosystem

A libsystemd stub library, a research project for Devuan
C
18
star
18

packlim

A small, hackable and secure package manager
C
16
star
19

overheadfs

A FUSE proxy file system
C
16
star
20

b6b

A lightweight, embeddable scripting language
C
15
star
21

toolchains

Toolchains for ultra-portable static binaries
Shell
14
star
22

devsus

Libre Devuan for the Asus C201
Shell
14
star
23

fbim

A tiny framebuffer image viewer
C
13
star
24

lok

A Linux port of OpenBSD's awk
C
11
star
25

guppy-protocol

Unencrypted, UDP-based alternative to the Gemini protocol
Python
10
star
26

elfence

An overlay that verifies signed ELF binaries
C
9
star
27

roar-ng

Generic build system for GNU/Linux distributions; orphaned
Shell
8
star
28

nss-block

A transparent, domain-based ad blocker
C
7
star
29

dillo

Dillo 0.8.6, patched and working
C
6
star
30

packdude

A simple package manager that does the right thing and that's it; orphaned in favor of packlad
C
6
star
31

roar-ng-ii

A generic and extensible build system for GNU/Linux distributions; orphaned
Shell
5
star
32

locwm

A Linux port of OpenBSD's cwm
C
5
star
33

lolibc

An OpenBSD libc compatibility layer as a Meson subproject
C
4
star
34

boydemdb

Key-value database as a Meson subproject
C
4
star
35

krisa

A small library that generates crash dumps
C
4
star
36

literocks

A stripped-down fork of ROX-Filer; orphaned
C
4
star
37

nopdev

A device manager that does less
C
4
star
38

lobsder

An OpenBSD compatibility layer for Linux; orphaned
C
4
star
39

ogg122

A tiny Ogg Vorbis player
C
4
star
40

logfence

An overlay that prevents log tampering
C
4
star
41

packlad

A small, efficient and secure package manager; orphaned in favor of packlim
C
3
star
42

termolos

A console color scheme generator
C
3
star
43

darls

Dima's Already Riced Live System
3
star
44

ted

Ted 2.17, patched and working
C
3
star
45

subito

A minimalistic and versatile GNU/Linux distribution based on roar-ng; orphaned
Shell
3
star
46

frost

A simple suspend tool for GNU/Linux; orphaned
C
3
star
47

libretee

A fast, asynchronous implementation of tee(1); orphaned
C
3
star
48

frugalify

Converts a Puppy Linux "full installation" into a "frugal installation"
C
3
star
49

containers

Containers for C/Go development and CI
Slim
2
star
50

logoutd

An experimental, standalone fork of logind
C
2
star
51

2d-grey-rounded

Flat and minimalistic GTK+ theme
CSS
2
star
52

xplayargs

A xargs-like audio player
C
2
star
53

wpa_supplicant

Working copy of wpa_supplicant
C
2
star
54

packsiz

A tiny, hackable and secure package manager
Meson
2
star
55

emelfm

A lighter emelFM 0.9.2
C
2
star
56

xchat

X-Chat 1.8.9, patched and working
C
2
star
57

tinyunmute

A tinyalsa-based volume initialization tool
C
2
star
58

glib

GLib 1.2.10, patched and working
C
2
star
59

xz-embedded

A copy of upstream xz-embedded that allows shallow clones
C
1
star
60

cdaemon

Node.js addon that wraps the daemon() C function
C++
1
star
61

woof-CE-c201

Puppy Linux + Devsus = ?
Shell
1
star
62

code-oss-arm64

Dockerfile
1
star
63

go-papaw

Go module for papaw
C
1
star
64

honeybear

Dropbear 0.66, hacked to act as a poor man's honeypot
C
1
star
65

gdk-pixbuf

gdk-pixbuf 0.22.0, patched and working
C
1
star
66

beaver

Beaver 0.2.7, patched and working
C
1
star
67

packlim-recipes

Build system for packlim packages
Shell
1
star
68

ncsplash

A simple ncurses-based splash screen which reads strings from a FIFO and prints them to the screen, one at a time; orphaned
C
1
star
69

packlim-sd

A Linux-libre distro based on packlim and packlim-recipes
Shell
1
star
70

locwm-5.6

A Linux port of OpenBSD's cwm
C
1
star
71

part-hotplug-handler

A lightweight, udev-based, partition hotplugging notifier; orphaned
C
1
star
72

rox

ROX-Filer 1.2.2, patched and working
C
1
star
73

sazache

A tiny, scalable HTTP server for static sites
Makefile
1
star
74

gtk

GTK+ 1.2.10, patched and working
C
1
star