mirror of
https://github.com/sam-astro/Z-Sharp.git
synced 2025-12-11 16:22:12 +00:00
Update README.md
This commit is contained in:
parent
c75ba20ff6
commit
90dad7998f
21
README.md
21
README.md
@ -1,17 +1,18 @@
|
||||
<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"/>
|
||||
|
||||
## 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). It used to be called Slang, standing for "Stupid Lang", but another programming language called Slang already exists :(. Z-Sharp scripts have the file extension .zs. The base syntax and formatting I would say is quite similar to C#, 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). It used to be called Slang, standing for "Stupid Lang", but another programming language called Slang already exists :(. Z-Sharp scripts have the file extension .zs. The base syntax and formatting I would say is quite similar to C#, but differs as task complexity increases. It has support for graphics using SDL2.
|
||||
If you are thinking about using this language, then you may wish to reconsider. It is quite bare-bones, and doesn't have a lot of features. Also the syntax must be very exact and even a space, a missing space, or using spaces instead of tabs could throw an error.
|
||||
|
||||
## Installation
|
||||
Downloading or installing is very simple. I recommend the regular version if you are just exploring, and not the installer, because then you don't need to find the executable in your program files. If you plan on developing for a long time though, then you should use the installer and I'll guide you through that after.
|
||||
Downloading or installing is very simple, and you don't need to build it yourself. I recommend the regular version if you are just exploring, and not the installer, because then you don't need to find the executable in your program files. If you plan on developing for a long time though, then you should use the installer and I'll guide you through that after.
|
||||
### ZSharp Windows x64
|
||||
1. Navigate to [the most recent release](https://github.com/sam-astro/Z-Sharp/releases) and download `ZSharp-Win-x64.zip`.
|
||||
2. Unzip `ZSharp-Win-x64.zip` and open the unzipped folder.
|
||||
3. You will see many files. The Z# interpreter is `ZSharp.exe` and has a Z# icon. Any time you want to execute a script, this is the program that will be used. There are a few ways to use it:
|
||||
* Drag and drop any .ZS script directly onto the executable.
|
||||
* Use command line, providing path to executable and then to script like so:
|
||||
`> ./ZSharp.exe ./Pong-Example-Project/script.zs`
|
||||
* Use a command line, providing path to executable and then to script like so:
|
||||
`> .\ZSharp.exe .\Pong-Example-Project\script.zs`
|
||||
* Right-click on your .ZS script file, then select `'Open with...'`. Click `'More Apps'`, scroll down, and select `'Look for another app on this PC'`. Navigate to the `ZSharp.exe` executable and select it. Now whenever you double-click any .ZS file, it will automatically open with the interpreter.
|
||||
4. Feel free to use and edit the included `Pong-Example-Project`. It is a single script called `script.zs`, and you can open it with any of the methods above.
|
||||
### ZSharp Linux
|
||||
@ -37,29 +38,35 @@ Downloading or installing is very simple. I recommend the regular version if you
|
||||
```c++
|
||||
// Comments are indicated by two forward slashes
|
||||
// They can only be on their own line
|
||||
// int j = 4 // <- This is invalid comment placement
|
||||
int j = 4 // <- This is invalid comment placement, and will throw an error
|
||||
|
||||
// All programs start with a main function
|
||||
func Main()
|
||||
{
|
||||
// Initialize variable by stating it's type, then name, then "=" and it's value
|
||||
int i = 0
|
||||
string s = "r"
|
||||
|
||||
// These operators will change the variable by the value on the right
|
||||
i += 2
|
||||
i -= 1
|
||||
i /= 3
|
||||
i *= 2
|
||||
|
||||
// Repeat until i >= 10
|
||||
while i < 10
|
||||
{
|
||||
i += 1
|
||||
}
|
||||
|
||||
// Check if the variable s contains the value "r"
|
||||
if s == "r"
|
||||
{
|
||||
print s + " is r"
|
||||
}
|
||||
|
||||
// Call function called "ExampleFunction" with two inputs, both as different types,
|
||||
// then get the return value and store it in the new variable "functionNumber"
|
||||
int functionNumber = ExampleFunction("A", s)
|
||||
ExampleFunction(1, 3)
|
||||
|
||||
@ -67,8 +74,8 @@ func Main()
|
||||
}
|
||||
|
||||
// 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
|
||||
// The input variables don't need types, as those are automatic. Also, they don't need to
|
||||
/// be assigned at all on execute and can be left blank by the caller
|
||||
func ExampleFunction(inputA, inputB)
|
||||
{
|
||||
print "In A is: " + inputA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user