Merge pull request #45 from sam-astro/master

Update dev
This commit is contained in:
sam-astro 2022-08-28 12:49:12 -04:00 committed by GitHub
commit 842cc84daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 9 deletions

View File

@ -1,12 +1,17 @@
<img src="https://raw.githubusercontent.com/sam-astro/Z-Sharp/master/ExtraResources/ZS-Gem-Icon-Small.png"/><img src="https://raw.githubusercontent.com/sam-astro/Z-Sharp/master/ExtraResources/ZS-Logo-Light-Small.png"/>
> Z-Sharp is no longer in development! This project was never meant to go beyond the scope of a simple thing I could make pong in, yet people continue to ask for features and fixes, and I continue to oblige. So sadly, even though this was a cool project in which I learned a lot, it will be ending now. I will eventually make some docs and standards for the syntax, and will still leave this repository open. This way anybody can make their own interpreter or compiler for it. I will also still accept pull requests for any changes to this repository.
## Introduction
Z-Sharp is a custom programming language I made because I don't like c++ very much (Z-Sharp's interpreter is written in c++ though). Z-Sharp scripts have the file extension .ZS. The base syntax and formatting I would say is quite similar to C# or Python, but differs as task complexity increases. It has support for graphics using SDL2, and by default is not enabled.
Z-Sharp is a custom programming language I made because I don't like c++ very much (Z-Sharp's interpreter is written in c++ though). Z-Sharp scripts have the file extension .ZS. The base syntax and formatting I would say is quite similar to C# or Python, but differs as task complexity increases. It also has support for graphics using SDL2.
Before using 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. Z-Sharp 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***.
## Documentation and getting started:
[The docs and tutorial](https://spazelectro.github.io/ZSharpDocs/#/README)
## Installation
Downloading or installing is very simple, here is how depending on your version and operating system:
### Windows

View File

@ -145,14 +145,6 @@ func GetKey(keyName)
return b
}
// WIP
//func SplitThread(function)
//{
// ZS.System.SplitThread(function)
//}
////////////////////////////
// ↓ MADE BY KAPUTCHINO ↓ //
////////////////////////////
@ -213,5 +205,19 @@ func Perm(n, r)
return Fac(n) / Fac(n - r)
}
//////////////////////////////////////////
// ↓ MADE BY CONCHETUMARE_PRODUCTIONS ↓ //
//////////////////////////////////////////
func GetPercent(value, percent)
{
float temp = value * percent / 100
return temp
}
//gets 100% of number
func PercentToHundred(value, percent)
{
float temp = value * 100 / percent
return temp
}
)"
;

View File

@ -1,6 +1,14 @@
#ifndef BUILTIN_H
#define BUILTIN_H
#if defined(__unix__)
#define UNIX true
#define WINDOWS false
#elif defined(_MSC_VER)
#define UNIX false
#define WINDOWS true
#endif
#include <iostream>
#include <fstream>
#include <string>
@ -13,6 +21,7 @@
#include <ctime>
#include <math.h>
#include <sys/stat.h>
#include <cstdlib> // for console command printing
#include "strops.h"
#include "graphics.h"
@ -467,6 +476,13 @@ boost::any ZSFunction(const string& name, const vector<boost::any>& args)
Vec2 v(AnyAsFloat(args.at(0)), AnyAsFloat(args.at(1)));
return v;
}
else if (name == "ZS.System.Command"){
string command = StringRaw(AnyAsString(args.at(0)));
//int command_len = command.length();
//char* command_char_arr=new char[command_len + 1];
//strcpy(command_char_arr, command.c_str()); // string into char arr
int k = system(command.c_str());
}
else
LogWarning("ZS function \'" + name + "\' does not exist.");

View File

@ -0,0 +1,5 @@
func Main()
{
Printl("this is a test:")
ZS.System.Command("cls")
}