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
- Host: GitHub
- URL: https://github.com/vwh/crust
- Owner: vwh
- License: mit
- Created: 2025-01-08T06:39:11.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-01-23T13:32:30.000Z (11 months ago)
- Last Synced: 2025-01-23T14:29:01.062Z (11 months ago)
- Topics: language-design, programing-language, scripting-language
- Language: TypeScript
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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