A small language for
building things.
Plain text files. No build step. No toolchain to configure before your
first program runs. Write .zng in any editor and run it with
one command.
class Dog {
let name
func new(name) { self.name = name }
func speak() { return self.name + " says woof" }
}
print(new Dog("Rex").speak())
Packages
Install a library from the terminal, then use it by name.
Install
zing install mathx
Installed into ~/.zing/packages. Add
--upgrade to update, zing list to see what you
have.
Use
import mathx
print(mathx.mean([1, 2, 3]))
A package is a folder of .zng files with a
zing.json manifest, so you can also install straight from
a folder.
Publish
zing publish
Uploads the package to the registry. The registry is
self-hosted and standard-library only —
tools/registry_server.py.
Install
Linux & macOS
One command. No sudo, nothing outside your home directory.
curl -fsSL https://jaivardhanpandey66-create.github.io/zing/install.sh | sh
Puts zing in ~/.local/bin. Add
--with-associate to register .zng files with
your desktop.
Windows
Paste one line into PowerShell. It downloads the runtime and the
language, then puts zing on your PATH. No administrator
rights, nothing installed system-wide.
iwr https://raw.githubusercontent.com/jaivardhanpandey66-create/zing/main/install.ps1 -useb | iex
From a checkout, run
powershell -ExecutionPolicy Bypass -File .\install.ps1.
Already have Python 3.11? It is used instead of downloading another
copy. A single-file installer is produced by
packaging/windows/build-installer.sh on Windows with
Inno Setup.
Any editor
There is a VS Code extension on the Marketplace.
code --install-extension zing.zing
Other editors: point your run command at
zing run <file>.
From a checkout
git clone https://github.com/jaivardhanpandey66-create/zing
cd zing && ./install.sh --local .
What it looks like
Classes that just work
Fields, methods, one optional constructor called new,
and extends for inheritance. Overridden methods dispatch
the way you would hope, with nothing to configure.
C++ when you want it
import gpp compiles and runs real C++ from inside a
zing program and hands the output back. Results are cached by source
hash.
Errors that point somewhere
Syntax errors report a line and column and draw a caret under the problem. An accidental infinite loop stops with a message instead of hanging your editor.
Modern where it counts
Keyword arguments, sets, list and map comprehensions, generators
with yield, @decorators, function values and
closures, destructuring like let [a, b] = pair, run-time
type annotations, and regex built in.
The whole language
Values
int float str bool null list map setDeclare
let x = 1
let [a, b] = pairFunctions
func f(a: int, b = 10) -> int {}Classes
class Dog extends Animal { }Choose
if ... elif ... elseLoop
for i in 0..5
for x in gen()Comprehensions
[x*x for x in xs]
{k: v for k in ks}Generators
func g() { yield 1 }Decorators
@log
func f() { }Sets
{1, 2, 3}
a | b a & b x in aCall
f(b: 2, a: 1)Errors
try { } catch e { }Builtins
print len str int push pop range typeBuilt-ins
has keys values sqrt next re_matchIn your editor
Highlighting, snippets, F5 to run, Ctrl+Shift+B to check, and errors as red squiggles.
- Syntax highlighting for every token class the language has
- Snippets for classes, constructors, loops and maps
- Problems parsed from the CLI, never re-implemented in the extension
zing fmtrewrites the buffer, and refuses to if it would change what the program means