bop-cli-0.2.0 is not a library.
bop
A small, dynamically-typed programming language, designed for learning to code.
Note: Bop is experimental and has not been battle-tested. Do not use it in production or mission-critical environments.
Features
- No dependencies
- Simple, expressive syntax
- Functions with recursion
- Arrays, dictionaries, and string interpolation
- Built-in resource limits (step count, memory) for safe embedding
- Embeddable via the
BopHosttrait - Easy to learn, with helpful error messages
Examples
// Variables and string interpolation
let name = "world"
print("Hello {name}!")
// Functions
fn fizzbuzz(n) {
if n % 15 == 0 { return "FizzBuzz" }
if n % 3 == 0 { return "Fizz" }
if n % 5 == 0 { return "Buzz" }
return str(n)
}
// Loops and arrays
let results = []
for i in range(1, 16) {
results.push(fizzbuzz(i))
}
print(results.join(", "))
// Dictionaries
let player = {"name": "Ada", "hp": 100}
player["hp"] -= 20
let name = player["name"]
let hp = player["hp"]
print("{name} has {hp} HP")
// Built-in methods
let words = "the quick brown fox".split(" ")
words.sort()
print(words.join(", ")) // brown, fox, quick, the
Quick start
cargo install bop-cli
Run a file:
bop script.bop
Or start the REPL:
bop
Embedding
Add bop-lang to your Cargo.toml:
[]
= "0.2"
use ;
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.