Skip to content

A fully programmable, multi-platform, syntax-slick modern language. Let’s finish this strong. πŸ’ͺ

License

Notifications You must be signed in to change notification settings

profullstack/smashlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SmashLang: A JS-like Programming Language in Rust

Crypto Payment

SmashLang logo

SmashLang is a JavaScript-inspired programming language implemented in Rust that compiles to native binaries across all major platforms (desktop, mobile, server, WebAssembly, etc.). The language supports dynamic typing, native date/time, regular expressions, and control flow constructs like if, for, and while.

GitHub GitHub commit activity GitHub last commit

πŸš€ Features

  • JavaScript-like Syntax: Familiar syntax for JavaScript developers
  • Dynamic Typing: Flexible type system with runtime type checking
  • Native Compilation: Compiles to native binaries for all major platforms
  • WebAssembly Support: Compile to WebAssembly for web applications
  • Cross-Platform: Works on Linux, macOS, Windows, iOS, Android, and more
  • Standard Library: Built-in support for common operations
  • Regular Expressions: Native regex support
  • Date/Time Handling: Comprehensive date and time functionality
  • Error Handling: Try/catch/finally mechanism
  • Modern Language Features: Destructuring, pattern matching, async/await, and more

Platforms

Android iOS Windows macOS Linux Web

🧰 Implementation

SmashLang is built using modern Rust crates:

  • Lexer: Uses logos for efficient tokenization
  • Parser: Uses pest for parsing with PEG grammar
  • Interpreter: Custom interpreter with dynamic typing
  • Compiler: Native code generation using cranelift
  • Standard Library: Implemented using Rust's ecosystem (chrono, regex, etc.)

πŸ“¦ Installation

From Source

# Clone the repository
git clone https://github.com/profullstack/smashlang.git
cd smashlang

# Build the project
cargo build --release

# Install the binaries
cargo install --path .

Using the Install Script

curl -sSL https://raw.githubusercontent.com/profullstack/smashlang/refs/heads/master/install.sh | bash -s -- --master

πŸš€ Quick Start

Hello World

Create a file named hello.smash:

// hello.smash
print("Hello, SmashLang!");

Run it:

smash run hello.smash

Compile to Native Binary

smashc hello.smash -o hello
./hello

Compile to WebAssembly

smashc hello.smash --wasm -o hello.wasm

πŸ“š Documentation

Comprehensive documentation is available in the docs directory:

πŸ§ͺ Examples

SmashLang comes with a variety of examples to help you learn:

Language Features

OS Integration

WebAssembly

Hardware Integration

πŸ§ͺ Testing

Run all examples:

cd docs
./test_all_examples.sh

Run the test suite:

cargo test

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the ISC License - see the LICENSE file for details.

About

A fully programmable, multi-platform, syntax-slick modern language. Let’s finish this strong. πŸ’ͺ

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •