Holy Z is a custom programming language forked from Z-Sharp and optimized like Holy C. Holy Z's interpreter is written in C++ and supports both traditional Z-Sharp syntax and Holy C-inspired features. Holy Z scripts have the file extension .ZS. The base syntax is similar to C# or Python, but includes Holy C extensions for more flexible programming. It also has support for graphics using SDL2.
Before using Holy Z: There is no documentation, strings barely work, performance isn't great, the syntax is very specific, and most errors just cause it to crash without warning. I am just a single developer working on this during my free time; between school, other projects, and YouTube. Holy Z will most likely never be finished, since it was really supposed to end when the video was published about it. If you are trying to use a common programming language feature, ask yourself this: Is this feature required to play pong? If not, then most likely that feature has not been implemented yet. I initially only made the language so I could create pong and make a video about it, so it really is the bare minimum.
Downloading or installing is very simple, here is how depending on your version and operating system:
- Navigate to the most recent release and download
HolyZ-Win-Installer.zip. - Unzip
HolyZ-Win-Installer.zipand open the unzipped folder. - Inside is a single file titled
HolyZ-Setup.exe. Run it, and follow the setup instructions. - If it fails to run, make sure the
MS Visual Runtime and MSVC C++ Redistributeare installed. You can download them here from Microsoft - Now that it is installed, there are a few ways to use it:
- (recommended) Any HolyZ file that ends with .ZS will automatically be associated with the interpreter. Just double-click it, and the interpreter will run.
- Drag and drop any .ZS script directly onto the executable.
- Use command line, providing path to interpreter and then to script like so:
> ./HolyZ.exe ./Pong-Example-Project/script.zs
- Feel free to use and edit the
Pong-Example-Project. It is a single script calledscript.zs, and you can open it with any of the methods above. It is also located on the releases page.
If you don't want to install HolyZ on your device, or you want easier access to the executable and .DLLs, another version is provided called
HolyZ_Win_Base_Raw.zip. This just contains all of the files the installer puts on your computer.
- Install requirements:
SDL2, SDL2 Image, SDL2 TTFCommands foraptandpacmanbelow:
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
$ sudo pacman -S sdl2 sdl2_image sdl2_ttf
- Navigate to the most recent release and download
HolyZ-Linux.zip. - Unzip
HolyZ-Linux.zipand open the unzipped folder. - You will see some files. The Holy Z interpreter is
HolyZ. Any time you want to execute a script, this is the program that will be used. You can use it like so:- Use terminal, providing path to executable and then to script like so:
$ ./HolyZ ./Pong-Example-Project/script.zs
- Use terminal, providing path to executable and then to script like so:
- Feel free to use and edit the included
Pong-Example-Project. It is a single script calledscript.zs, and you can open it with any of the methods above.
// Comments are indicated by two forward slashes
// They can only be on their own line
// int j = 4 // <- This is invalid comment placement
// All programs start with a main function
func Main()
{
int i = 0
string s = "r"
i += 2
i -= 1
i /= 3
i *= 2
while i < 10
{
i += 1
}
if s == "r"
{
Printl(s + " is r")
}
int functionNumber = ExampleFunction("A", s)
ExampleFunction(1, 3)
GlobalFunction()
}
// Declare new function with 'func', then it's name, and the names of any input variables.
// The input variables don't need type, as those are automatic. Also, they don't need to
/// be assigned at all on execute and can be left blank
func ExampleFunction(inputA, inputB)
{
Printl("In A is: " + inputA)
Printl("In B is: " + inputB)
// Return a value to the valling location
return 4
}
func GlobalFunction()
{
// Create variables that can be accessed from anywhere (ex. in Main or ExampleFunction) with the 'global' keyword before type
global int x = 12
global string y = "Y String"
}Here is how to use graphics:
func Main()
{
int screenWidth = 500
int screenHeight = 500
ZS.Graphics.Init("Title of window", screenWidth, screenHeight)
// After graphics are initialized, the main function will not finish.
// Instead, Start() will be called a single time, then Update() every frame after that.
}
// Runs once at start of graphics initialization
func Start()
{
// Vec2 are initialized using function 'NVec2(x, y)'
Vec2 position = NVec2(250, 250)
Vec2 scale = NVec2(20, 20)
float rotation = 0
// Sprite object, stores (and loads from file) the texture, location, scale, and rotation
global Sprite exampleSprite = ZS.Graphics.Sprite("./square.png", position, scale, rotation)
}
// Executes each frame
func Update(deltaTime)
{
// Draws the image created in Start(). This is usually at the end of update.
ZS.Graphics.Draw(exampleSprite)
}Currently, ZSharp is VERY strict with formatting, and can throw an error if you forget to put a space somewhere.
Holy Z supports Holy C-inspired syntax when using the #holyc on pragma:
#holyc on
func Main()
{
"Hello World\n"; // Auto-prints string literals
int i = 5;
if (0 < i < 10) { Printl("In range"); } // Range operators
Printl(2 ^ 3); // Exponentiation operator (result: 8)
// Optional parentheses for functions with no args
SomeFunction; // Same as SomeFunction()
}Run Holy Z in interactive shell mode:
./HolyZ --shellExample:
ERROR: line 5 in function Main
This is the 5th line inside of Main.
func Main()
{
// line 1
// line 2
// line 3
// line 4
int g = "s"
// ^ above line is the error, since it is line 5
}I am planning to change how error reporting works to report the document line number as well, but this is how it is for now.