A lightweight programming language with a built-in Studio and pygame functions.
Project description
Sapphire is an easy programming language to learn, created by GitHub@CodeyWaffle, with the help of Google Gemini and ChatGPT, built on the basics of Python and C++ (Windows Only) The Sapphire programming language is designed as a fast, simple, and portable tool with native UI capabilities [1]. It is licensed under MIT, allowing for building, selling, and remixing, but includes a "Be a good guy" policy emphasizing responsible use, prohibiting the creation of weapons or harmful software, requiring credit for major projects or forks, discouraging harassment automation, and promoting innovation over imitation [1]. Visit the Sapphire Programming Language GitHub repository for more details.
Executing the code
Sapphire 15 and beyond:
Install pygamece or pygame and pygame-supported Python versions
Download Sapphire(version) in a ZIP or directly in a folder, then extract it
Open the launchSapphire.bat in the folder
You can run and save the code directly on the SapphireStudio(launches when you clicked the .bat file)
before Sapphire 15, not including:
Download Sapphire.py.
Code a Sapphire code in any notepad application and save it as a .sp file.
Put the Sapphire.py interpreter in the same folder as your .sp file project.
Change destination in your computer terminal to the folder that saved the Sapphire files.
enter python Sapphire12.py YourProject.sp
You can see your project running.
New Commands: (Sapphire 15 and beyond)
// - description
Variables
var type(name){value} - Creates a variable (int, flt, str, bol, lst).
Constants
const var type(name){value} - Creates a read-only variable that cannot be changed.
Jumping
jump.n - Immediately stops the current block and starts executing the area named n.
Defining Areas
def area (n) { } - Creates a named logic block for jumps or organization.
Fixed Loops
loop(n) { } - Executes the code inside $n$ times during a single main cycle.
Condition Loops
setLoopUntil(cond) { } - Runs until the condition evaluates to true.
State Loops
setLoopWhen(cond) { } - Runs as long as the condition remains true.
Conversion
convert(type1 var n){type2} - Migrates a variable from one data type to another.
Output
print() and println() - Sends data to the Studio console.
Graphics
set_screen(w, h), draw_rect(COL, x, y, w, h), and update_display().
Core Rules & Logic
Variable Declaration: Only one variable should be declared per set of brackets.
Boolean Syntax: All boolean logic must use lowercase letters (e.g., true, false, &&, ||).
Conditionals: if statements only execute the code block if the condition is strictly true.
Graphics Sequence: You must call set_screen() before using any drawing commands like draw_rect.
Encoding: Your files support full UTF-8, allowing you to use emojis and special symbols in strings.
Workspace Management: Always use the .bat file to ensure the latest library version is copied into your project folder.
Old Basic code structure: (before Sapphire 15, not including)
.start.program{}
.setup{}
.main{}
.end.program
Old Commands: (before Sapphire 15, not including)
// - description
setLoop(n){until(a){b}} - same as for(n, a, b) in C++
jump.n - jump to an area named n
def area (n) - create an area n
loop(n) - loop n times in one .main cycle
var int (n){1} - create an integer variable n and n = 1
print() - print something
println() - print something and change line
const var int (n){1} - create a constant integer variable n and n = 1
convert(int var n){str} - convert an integer variable n into string
basic boolean logics
numerical calculations
Rules: Only one variable in the same brackets If satements only run if condition = true (not false) Boolean logics in lowercase letters
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sapphire_language-1.7.1a0.tar.gz.
File metadata
- Download URL: sapphire_language-1.7.1a0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccda8e55ea791364955f58c8f207fff5152b5dcd511f7b563cde4fb0e96ecfc5
|
|
| MD5 |
0f6eccc942ebf2a81d2cf68d83e2b91a
|
|
| BLAKE2b-256 |
ca6a06735aee80d663d8584ae558f4e265f3edd0aa4ef889fde8a5a1f4f8bfb9
|
File details
Details for the file sapphire_language-1.7.1a0-py3-none-any.whl.
File metadata
- Download URL: sapphire_language-1.7.1a0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61c8f846aacbcfb8f9adb1954d38abedd80360cd59f808dd08980c8a0bbbde82
|
|
| MD5 |
077b4c8f45acd3ccaf90d82169ab3ae6
|
|
| BLAKE2b-256 |
3813a2f3b3271fa3d8e94dd56b50e38342ee9e9460f9bba044cc81de41655d93
|