SkillAgentSearch skills...

Zang

Zang is a dynamically typed high level programming language.

Install / Use

/learn @cmspeedrunner/Zang
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Zang

Zang is a dynamically typed high level programming language.<br>image << Zang's Mascot, Sid

Official Website

To see the official zang website click on this!

Running a script

To run a script must go into the command prompt and make sure your working directory has your script you want to run and the run.py file and the intepreter.py file. Then run. python run.py yourfile.zang and it will run

Starting the shell

To start the shell simply run, in the command line python shell.py and thats it

Accesing Shell history

You can acess the shell history by typing in ac.history Like so:<br> <br> image

Text Editor

I would highly recommend using the text editor to write your programs, it has syntax highlighting and a built in terminal to do everything you need to do, it is very useful to use and is a great tool to help you write better Zang. This is what a simple fibbonachi sequence and fizzbuzz in Zang's Text editorimage image

Showing Speed

When you run your zang program, it wont, by default display the speed, to enable to display the speed, you have to include -s when running, so for example

C:\Users\User\Desktop\Projects\zang>py src/run.py examples/libtest.zang -s
Hello, World!
0
Zang executed in 0.00
C:\Users\User\Desktop\Projects\zang>py src/run.py examples/libtest.zang
Hello, World!
0

Using ZPM

ZPM is the Zang Package Manager and is how you can download any standard zang library from your command line. To use it, type in:

C:\Users\User\Desktop\Projects\zang>py zpm/zpm.py install library

This will download the library to your working directory.<br> ZPM can only download the libraries in examples/using/libraries dir which are the official libraries, if you want to make a zang library, just upload it to the examples/using/libraries dir!

You can also download several libraries at once

C:\Users\User\Desktop\Projects\zang>py zpm/zpm.py install library1 library2

Or you can download all the libraries at once

C:\Users\User\Desktop\Projects\zang>py zpm/zpm.py everything

If you download all the libraries, they will be saved in the using/ folder in your directory

Tutorial

Your first Zang Program

Your first Zang program will be a simple hello world program, all it does is output hello world to the console. To output any value to the std.output you would do writeln to write a line and then your value between the corresponding brackets, so a simple hello world program would look like this:<br>

writeln("Hello, World!")

There it is, now save it, run it and see what it outputs, it should output

Hello, World!

Variables

Variables are pretty simple, to allocate memory into a variable you would use the let keyword, like this:<br>

let message = "Hello, World!"

now you can output this to make another hello world program, this time using variables, like this:

let message = "Hello, World!"
writeln(message)

This, once again should output

Hello, World

For loops

A little step up from the past 2 programs we made, this program we made will include a loop, How exciting! This specific one we will make will count up to 100 and output the numbers:<br>

for i = 0 to 100 then
   writeln(i)
end

When you run this you should get numbers 0-99 being outputted to your console.<br>

Endless Loop?!?

Yes, we can do an endless while true loop with Zang:<br>

while True then
  writeln("Endless!")
end

-Note: I dont suggest running this as it will print "Endless!" to the console forever, but if you want to, go for it!

Reading Input

To read input you just have to do read("") to gather input. Make sure you have a string, cannot be an empty bracket. For example:<br>

let x = read(">")
writeln(x)
let x = read_int(">")
writeln(x+x)

Colors!

I specifically wanted it to be easy to print in colored formats in Zang, so i made an easy color library implemented into it. An example of it would be like this:<br>

writeln(col_red+"Red Text!"+col_reset)
writeln(col_purple+"Purple Text!"+col_reset)
writeln(col_blue+"Blue Text!"+col_reset)
writeln(col_yellow+"Yellow Text!"+col_reset)
writeln(col_green+"Green Text!"+col_reset)

-Note: It is important to include the col_reset at the end of every color line, otherwise it wont know the bounds and will print everything in that color from there on, you have to tell it where to stop coloring text

Lets make another, better program

With all this newgiven knowledge, lets write a simple echo program, which takes input from a user, stores it in a variable and then outputs that variable in colored, formatted text:

while True then
   let echo = read(">>")
   writeln(col_purple+echo+col_reset)
end

This isnt too complex but is still a fun program to mess around in.<br>

CMD Interop

Zang can interop with cmd systems to pass commands through to the cmd line! It can do some pretty powerful things so be careful with it, this is how it looks:<br>

passc("start cmd") 

This will pass the command "start cmd" to the command line.<br>

Command app with Zang

We can now make a simple program with the Zang system library:<br>

while True then
   let echo = read(col_purple+"Command>"+col_reset)
   passc(echo)
end

This is a simple command line made in Zang.

Put?

There are 2 ways mainly to write to the std output. These would be writeln and put and there is an important difference between these.<br> put will print a value with no newline, meaning that if you did:<br>

put("hello")
put("world")

It would output

helloworld

Whereas if you did this with writeln:<br>

writeln("hello")
writeln("world")

It would output

hello
world

System Messages

Adding again to the extensive system library we can do a system message, that looks like this:<br> image<br> The way you can do this is very easy, its just msg so a program that uses it would look like this:<br>

msg("Hello, Zang!")

Its a very interesting tool to use and can be usd in many projects to display user sucess or error messages

Web Interop

Just like Zang can interop with Cmd, it can also interop with your native web browser and allows you to open any url you want from Zang, it looks like this:<br>

let url = read("What url do you want to open: ")
opentab(url)

Types

You can get the type of something by calling classof, here is an example:

writeln(classof([1,2,3]))
writeln(classof(1))
writeln(classof(1.1))
writeln(classof(True))
writeln(classof("String!"))

This will output:

array
number
number
number
string

This is because floats and ints share a class, for simplicity and boolean is equal to a number, 1 is true and 0 is false, this is why if you do True + True, it outputs 2. This little program prompts a user for a url to open and then opens whatever they enter.

Functions

Functions are done with the fn keyword and dont require a then keyword, let me show you a function which multiplies 2 numbers<br>

fn multiply_nums(num1, num2)
   writeln(num1*num2)
end

multiply_nums(5,10)

This would output:

50

Functions can also return values

Raising Errors

To raise an error, you can use the `error keyword like this:

error("This is a raised error!")

Comments

To do comments you would use a hashtag (#) for example:

writeln("hello") # Comment right here!
put("Bye!") # Another comment!

-Note: It is important to know that there has to be a newline under the comment, otherewise the interpreter cannot look for a "\n" to stop parsing the comment. Sorry, i know this is bad but it would be better then a grouping based comment system.

Importing a file

You can import a file through zang using the using keyword. Like this

using("main.zang")
init()

Given that you have defined any function in your code, you can call it after using it. Make sure everything in your file is within a function though, otherwise anything in the global scope will run on import.<br> If you go to examples/include you will see all the external libraries for zang and examples of them being imported and used in the main.zang file. Descriptions of these:<br>

All libraries

  1. win.zang - A windows interop library
  2. bettermath.zang - A math library to improve the std math lib.
  3. zecl.zang - Zang Expanded Color Library expands the already large inbuilt color library and doesnt require closing tags, it goes from writeln(col_red+"red"+col_reset to writeln(red("red")). If you are making a program in zang with alot of color change, i would suggest using zecl.zang
  4. demos.zang - A library full of zang demos with things like fizzbuzz to a number, counting up, name printing programs and more.
  5. c_interop.zang - A library that allows you to run c code, by calling compile(yourprogram.c).
  6. py_interop.zang - A library that allows you to run python code through zang
  7. tooey.zang - A library full of drawing with ascii to make a nice TUI, it includes circles, squares, triangles, caps, ovals and crescent shapes.
  8. yt.zang - A library for searching on youtube. Will do just that, search for a video on youtube and then open that url
View on GitHub
GitHub Stars35
CategoryDevelopment
Updated11mo ago
Forks3

Languages

Python

Security Score

67/100

Audited on Apr 27, 2025

No findings