| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A simple, powerful programming language with TypeScript-inspired syntax that compiles to native code via C transpilation.
Native performance • Rich tooling • Modern syntax • Zero-cost abstractions
# Build the compiler
cargo build
# Compile and run a Bolt program
./target/debug/bolt examples/hello.bolt -o hello
./out/debug/hello
# Run all example programs
./run_examples.sh
# Test the compiler
./run_tests.sh # Complete test suite (61 tests)✅ Core Language:
✅ Control Flow:
✅ Functions:
✅ Data Structures:
✅ Module System:
✅ Standard Library:
✅ Developer Experience:
Get rich IDE support with syntax highlighting, hover docs, and auto-completion:
# Install the Bolt VS Code extension
./reinstall-extension.sh
# Restart VS Code and open any .bolt fileFeatures:
The Bolt LSP server works with any LSP-compatible editor:
# Build the LSP server
cargo build --bin bolt-lsp
# Use the binary at: ~/.vscode/extensions/bolt-language-lsp-0.2.0/bin/bolt-lspSupported LSP features:
./run_tests.sh # All tests, comprehensive validation# Debug build
./target/debug/bolt examples/hello.bolt -o hello
# Release build (optimized)
./target/debug/bolt examples/hello.bolt -o hello --release🎉 PRODUCTION READY - Comprehensive language with native C integration!
Compilation Pipeline:
Bolt Source (.bolt) → Lexer → Parser → AST → C Code Generator → GCC → Native Executable
Key Components:
Hello World:
import { print } from "bolt:stdio"
print("Hello, World!")
Function with Documentation (LSP-Enabled):
import { print } from "bolt:stdio"
/**
* Calculates the factorial of a given number using recursion
* This demonstrates Bolt's documentation comment support
*
* Example usage:
* val result = factorial(5) // Returns 120
*/
fun factorial(n: Integer): Integer {
if n <= 1 {
return 1
} else {
return n * factorial(n - 1)
}
}
/** The user's name for personalization */
val userName: String = "Alice"
val result := factorial(5)
print("Factorial: " + toString(result))
Struct Example:
import { print } from "bolt:stdio"
import math from "bolt:math"
type Point = {
x: Integer,
y: Integer
}
fun distance(p1: Point, p2: Point): Integer {
val dx := p1.x - p2.x
val dy := p1.y - p2.y
return math.abs(dx) + math.abs(dy)
}
val origin := Point { x: 0, y: 0 }
val point := Point { x: 3, y: 4 }
val dist := distance(origin, point)
print(dist)
🆕 Generic Array[T] Example:
import { print } from "bolt:stdio"
type Array[T] = {
data: ^T,
length: Integer,
capacity: Integer
}
type Person = {
name: String,
age: Integer
}
/** Create an Array[Integer] with one element */
val number: Integer = 42
val numbers: Array[Integer] = Array[Integer] {
data: &number,
length: 1,
capacity: 10
}
/** Iterate over the generic array */
print("Array[Integer] iteration:")
for item in numbers {
print(item) // Prints: 42
}
/** Works with custom types too! */
val person: Person = Person { name: "Alice", age: 25 }
val people: Array[Person] = Array[Person] {
data: &person,
length: 1,
capacity: 5
}
print("Array[Person] iteration:")
for p in people {
val name := p.name
val age := p.age
print(name) // Prints: Alice
print(age) // Prints: 25
}
🔥 Monomorphization Magic: The compiler automatically generates optimized C structs:
// Array[Integer] becomes:
typedef struct {
int* data;
int length;
int capacity;
} Array_Integer;
// Array[Person] becomes:
typedef struct {
Person* data;
int length;
int capacity;
} Array_Person;We welcome contributions! Here's how to get started:
git clone https://github.com/YOUR_USERNAME/boltlang.git
cd boltlang
cargo build
./run_tests.sh # Make sure everything worksSee ROADMAP.md for the comprehensive development roadmap.
This project is licensed under the MIT License.
Ready to bolt into action? ⚡
/**
* Welcome to Bolt - where performance meets productivity!
*/
fun main() {
val message := "The future of programming starts here!"
print(message)
}
Built with ❤️ by the Bolt community
| Back | FazBrowse Home | New Git URL |