Introducing ZuzuScript

So I’ve created a programming language which blends a fairly JavaScript-like syntax with fairly Perl-like semantics, and a few other features that I haven’t really seen in many programming languages.

This Perl:

use Path::Tiny;

my $str = uc(substr(Path::Tiny->new("myfile.txt")->slurp_utf8, 0, 80));

Becomes this in ZuzuScript:

from std/path import Path;

let str := new Path("myfile.txt")
  ▷ ^^.slurp_utf8
  ▷ ^^[0:80]
  ▷ uc ^^;

The operator means “evaluate the left side, then evaluate the right side with ^^ set to the result of the left side”. It’s conceptually similar to | in shells and seems to make a lot of expressions so much easier to understand.

Other features I like:

  • Path/query operators for XPath/JSONPath-like deep access to nested objects.

  • Built-in async/await.

  • OO including roles/traits.

  • Runs in the browser!

  • PairLists (like hashes, but with ordered keys that allow duplicate keys)

  • for/else

Familiar things from Perl: documentation uses pod, variables are lexical (actually almost everything is lexical), there’s a topic variable (but it’s called ^^ instead of $_), different operators for different data types (> for numbers but gt for strings), weak typing, keywords like say and warn, first class regexps, and a CPAN-like site for sharing modules.

The primary implementation is in Perl, but there are alternative implementations in Rust and JavaScript. Yes, this is coded with AI assistance.

More info: https://zuzulang.org/.

Leave a Reply

Your email address will not be published. Required fields are marked *