#programming-language #built #github #performance #syntax #clean #readable

bin+lib jist

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

10 releases

new 0.1.9 Dec 7, 2024
0.1.8 Dec 3, 2024
0.1.7 Nov 21, 2024
0.1.3 Oct 23, 2024

#436 in Development tools

Download history 196/week @ 2024-10-16 274/week @ 2024-10-23 4/week @ 2024-10-30 124/week @ 2024-11-06 28/week @ 2024-11-13 402/week @ 2024-11-20 116/week @ 2024-11-27 151/week @ 2024-12-04

698 downloads per month

MIT license

365KB
8K SLoC

Jist Programming Language

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.


Table of Contents

  1. Introduction
  2. Installation
  3. Syntax Overview
  4. Data Types
  5. Control Structures
  6. Functions
  7. Error Handling
  8. Standard Library
  9. Examples
  10. Contributing
  11. License

WIKI

Check out the wiki: https://github.com/jon429r/JistR/wiki

Introduction

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.

Key Features:

  • Simple and expressive syntax
  • Safe and fast, leveraging Rust's ownership model
  • Flexible typing system with both static and dynamic capabilities
  • Built-in concurrency support using Rust's async features
  • Cross-platform support, compiling to efficient binaries

Installation

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!");

Variables

//Copy code
let name: string = "Jist";
let version: float = 1.0;

Comments

//Copy code
// This is a single-line comment

/* 
   This is a 
   multi-line comment 
*/

Data Types

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}

Control Structures

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
}

Functions

!Important Not yet implemented

//Copy code
func add(a: int, b: int) -> int {
    return a + b;

Error Handling

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

Standard Library

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)

Contributing

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.

License

Jist is licensed under the MIT License

Dependencies

~2–12MB
~78K SLoC