Crates.io | jist |
lib.rs | jist |
version | |
source | src |
created_at | 2024-10-21 01:38:10.787712 |
updated_at | 2024-12-07 02:00:30.441702 |
description | Welcome to Jist a lightweight and efficient programming language built in Rust, designed for simplicity, flexibility, and fast performance with a clean and readable syntax. Github: https://github.com/jon429r/JistR |
homepage | |
repository | |
max_upload_size | |
id | 1416801 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Welcome to Jist, a lightweight and efficient programming language built in Rust. Jist is designed for simplicity and flexibility, offering fast performance with a clean and readable syntax. This README provides an overview of the language, its features, syntax, and installation instructions.
Check out the wiki: https://github.com/jon429r/JistR/wiki
Jist is built using Rust, taking advantage of its safety and performance. With a focus on minimalism, Jist is suited for both small scripting tasks and larger, more complex applications. Rust's ownership system ensures memory safety, and Jist inherits these properties, making it a secure and performant language.
Requirements:
# Install the Jist compiler (requires Rust installed)
cargo install jist
# If on Windows
./windows_setup.ps1
# If on Linux/macOS
./setup.sh
# Alternatively, you can manually build and install:
$ cargo install --path .
## Syntax Overview
### Hello World
```jist
print("Hello, World!");
//Copy code
let name: string = "Jist";
let version: float = 1.0;
//Copy code
// This is a single-line comment
/*
This is a
multi-line comment
*/
Jist supports both primitive and complex data types:
Primitive Types: Integer Float String Boolean Complex Types: Arrays Dictionaries
Jist will also try it's best to avoid type conflicts, meaning that the following
let a: float = 3.1;
let b: int = a;
Will result in b having a value of 3 instead of throwing an error
//Copy code
let age: int = 25; // Integer
let pi: float = 3.14; // Float
let greeting: string = "Hi"; // String
let firstInital: char = 'J'; // Char, notice singe quotes for chars and double quotes for strings
let isValid: boolean = true; // Boolean
Arrays and Dictionaries also come with built in functions to make working with them easier
Arrays:
Push(value)
Pop() -> value
append(value)
remove(index)
get(index) -> value
set(index, value)
print()
Dictionaries:
add(key, value)
remove(key)
get(key) -> value
set(key, value)
keys() -> array
values() -> array
print()
These functions are called simply by using dot notation
let a: dict<int, int> = {1 => 2, 3 => 4};
a.add(5, 6);
Initially a is a dictionary with the values {1 => 2, 3 => 4} Results after add() being {1 => 2, 3 => 4, 5 => 6}
If-Else
Copy code
if (condition) {
// do something
} elif (condtion){
// do something else
} else {
// do something else
}
Loops
//Copy code
for (i, 0..10) {
print(i);
}
while (condition) {
// do something
}
//Copy code
func add(a: int, b: int) -> int {
return a + b;
Jist uses try-catch blocks for error handling, inspired by Rust’s result and error types.
//Copy code
try {
// code that may fail
} catch {
// handle error
Jist has an extessive built in library which does even need an import. These are called by using standard function call syntax
IE
let a: string = to_uppercase("hello world");
print(a);
Output: HELLO WORLD
fn max(a: f64, b: f64) -> f64
fn min(a: f64, b: f64) -> f64
fn rand() -> f64
fn floor(a: f64) -> f64
fn ceil(a: f64) -> f64
fn round(a: f64) -> f64
fn add(a: f64, b: f64) -> f64
fn sub(a: f64, b: f64) -> f64
fn mult(a: f64, b: f64) -> f64
fn divide(a: f64, b: f64) -> f64
fn print(a: String)
fn println(a: String)
fn abs(a: f64) -> f64
fn pow(a: f64, b: f64) -> f64
fn sqrt(a: f64) -> f64
fn log(a: f64, base: f64) -> f64
fn sin(a: f64) -> f64
fn cos(a: f64) -> f64
fn tan(a: f64) -> f64
fn concat(a: String, b: String) -> String
fn len(s: String) -> usize
fn to_uppercase(s: String) -> String
fn to_lowercase(s: String) -> String
fn trim(s: String) -> String
fn input(s: String) -> String
fn read(file_path: String) -> String
fn write(file_path: String, content: String)
We welcome contributions! Please follow these steps if you would like to contribute:
Fork the repository. Create a new branch (git checkout -b feature-branch). Commit your changes (git commit -m 'Add new feature'). Push to the branch (git push origin feature-branch). Open a Pull Request. Please see CONTRIBUTING.md for more guidelines on contributing.
Jist is licensed under the MIT License