Skip to content

Instantly share code, notes, and snippets.

@marler8997
Last active September 22, 2023 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marler8997/e35e7089aca7e99467f4235ca88e17d7 to your computer and use it in GitHub Desktop.
Save marler8997/e35e7089aca7e99467f4235ca88e17d7 to your computer and use it in GitHub Desktop.
ZigScript

Since people seem to enjoy making scripting languages so much (not meant to be a "dig", I like this)...here's a scripting language I'd be very interested in.

ZigScript

"A companion scripting language meant for Zig developers."

Zig is my language of choice, but I still reach for Python when I want to make something fast or "short lived". However, Python has downsides, it's hard to build the interpreter for it (especially a static executable), its packaging system is a mess and it's got some interesting syntax choices that would feel foreign to a native Zig developer, but overall I think the core of the language is brilliant. I imagine ZigScript as Python but in a "Zig Style" syntax with the problems fixed. Here are some features that come to mind:

  • builtin types and/or syntax for maps/lists
  • automatic memory management
  • optional type specifiers?
  • call to/from native Zig code?

Maybe ZigScript should be a superset of Zig? Maybe ZigScript should compile to Zig? These might be difficult features to implement though so I wouldn't start there. Where I'd likely start is create a scripting language roughly based on the Zig grammar, but with an eye for where changes can be made. If all changes could be "options" or "additions" then it would be a superset so I'd be mindful about what kind of changes I'm making.

When I look at zig zen, all the points still seem to apply ZigScript...however, the priorities/tradeoffs change. For example we all want code to be easy to "read" and "write" but these two are commonly at odds with one another and Zig declares a side. I think ZigScript is on the same side as Zig but likely leans a little more towards the center, giving "writeability" a little more weight than Zig would. Since both Zig and Python have their own zen's the differences between the two would likely serve as a great guide to what decisions a ZigScript language would make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment