https://github.com/velzie/zsp
a small interpreted programming language built in rust
https://github.com/velzie/zsp
programming-language rust
Last synced: about 1 month ago
JSON representation
a small interpreted programming language built in rust
- Host: GitHub
- URL: https://github.com/velzie/zsp
- Owner: velzie
- Created: 2022-03-11T03:17:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-16T03:30:46.000Z (over 3 years ago)
- Last Synced: 2024-05-22T16:30:37.202Z (about 2 years ago)
- Topics: programming-language, rust
- Language: Rust
- Homepage: https://coolelectronics.me/playground/
- Size: 9.29 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zsp
This is the code for a toy language I built because I was bored.
The documentation for the language and guide is on the wiki, here is just a basic summary of the language and it's features
ZSP stands for "ZSP is Superior to Python", because I wanted one of those fancy recursive acryonyms and I couldn't come up with a better name
## getting started
You can download the interpreter and use all the features, or if you just want to play around, there's a [web interpreter](https://coolelectronics.me/playground/) available
If you decide to use the native interpreter, it will create a .zsp folder in your home directory where libraries will be loaded upon first run. If you want to use a library such as the `fs` or `dlopen` libraries, you will need to put the shared object there.
## features
supported:
dynamic typing
functions
variables
loading shared object libraries
objects
arrays
for loops
to be implemented:
closures
dlopen function
if else
## syntax
The syntax I ended up choosing is a mix of c and python, with some ideas stolen from various languages, mostly rust
for an example, here's fizzbuzz in zsp
```
mod a b{
r = a
loop{
r = r - b
if r < b{
return r
}
}
}
for counter 0 counter < 100 counter = counter + 1{
by3 = (mod counter 3) == 0
by5 = (mod counter 5) == 0
if by3 && by5 {
put "FizzBuzz"
}else{
if by3 && (by5 == false){
put "Fizz"
}
if by5 && (by3 == false){
put "Buzz"
}
if (by5 == false) && (by3 == false){
put counter
}
}
}
```
more information about the specifics are on the wiki