An open API service indexing awesome lists of open source software.

https://github.com/vwh/crust

Simple toy scripting language
https://github.com/vwh/crust

language-design programing-language scripting-language

Last synced: 8 months ago
JSON representation

Simple toy scripting language

Awesome Lists containing this project

README

          

# Crust scripting language

Crust Simple toy scripting language, JavaScript-like programming language.

## Features

### Currently Implemented

- Variables and Constants (`set` and `keep`)
- Functions and closures with lexical scoping
- Control Flow (`if`, `elif`, `else`, `while`)
- Break and Continue statements
- Basic Data Types
- Numbers ( Integers and Floating Points )
- Strings
- Booleans
- Null
- Objects
- Arrays
- Operators
- Arithmetic (`+`, `-`, `*`, `/`, `%`, `**`, `//`)
- Comparison (`==`, `!=`, `<`, `>`, `<=`, `>=`)
- Compound Assignment (`+=`, `-=`, `*=`, `/=`, `%=`, `**=`, `//=`)
- Logical (`&&`, `!!`)
- Unary (`!`, `-`, `+`)
- Exceptions handling with (`try`, `catch`, `throw`)
- Native Functions Support
- Standard Library

### Code Examples

```crust
# Variables
set x = 10
keep PI = Math.PI

# Functions
fn add(x, y) {
return x + y
}

# Objects
set person = {
name: "John",
age: 30
}

# Control flow
if x > 5 {
output("x is greater than 5")
} elif x < 5 {
output("x is less than 5")
} else {
output("x is equal to 5")
}

# While loops
while x > 0 {
x = x - 1
if x == 5 {
continue
}
output(x)
}
```

## TODO List

- [x] Comments
- [x] Float numbers
- [x] Arrays with proper array methods
- [x] String methods and operations
- [x] For loops
- [x] Error handling
- [ ] Module/import system
- [x] Implement standard library
- [ ] Template strings
- [ ] Add async/await support
- [ ] JavaScript block
- [ ] Optimization
- [ ] Documentation and Web Playground
- [x] VSCode extension for syntax highlighting