-
Notifications
You must be signed in to change notification settings - Fork 12
A lightweight, embeddable scripting language
License
dimkr/szl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
_ ___ ___| | / __|_ / | \__ \/ /| | |___/___|_| 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/).
About
A lightweight, embeddable scripting language
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published