Tip
Burnlang is on hold at the moment because of personal preferences
Burn is an easy-to-use general-purpose programming language designed with simplicity and expressiveness in mind.
Warning
Burn is not ready for Production! Syntax may still change and functions may not work. Please Report bugs as Issues
- Clean, readable syntax
- Strong and static typing
- First-class functions
- Struct-based type system
- Import system for code organization
- Built-in REPL for interactive development
- Go 1.24 or higher
- Clone the repository:
git clone https://github.com/burnlang/burn.git
cd burn
- Build the project:
go build
- Run the executable:
# On Unix/Linux/macOS
./burn
# On Windows
./burn.exe
Burn can be used in several ways:
burn path/to/file.bn
burn -r
burn -e 'print("Hello, World!")'
burn -exe path/to/file.bn
This compiles your Burn program into a standalone executable that can be run without the Burn interpreter. The executable will be named after your source file (e.g., file.exe
on Windows or file
on other platforms).
You can also specify a custom output name:
burn -exe path/to/file.bn custom-name
The compiled executable includes the Burn runtime and all imported dependencies, so it can be distributed and run without requiring Burn to be installed.
# Compile
burn -exe test/class.bn
# Run the executable
./class # On Unix/Linux/macOS
./class.exe # On Windows
Add the -d
flag to see tokens, AST, and execution details:
burn -d path/to/file.bn
var name = "John"
var age = 30
const PI = 3.14159
fun add(a: int, b: int): int {
return a + b
}
type Person {
name: string,
age: int,
active: bool
}
var person = {
name: "John",
age: 30,
active: true
}
print(person.name)
// Classes provide a way to organize related functions
class Human {
fun create(name: string, age: int): Human {
return {
name: name,
age: age
}
}
fun greet(human: Human): string {
return "Hello, " + human.name + "!"
}
}
fun main() {
var john = Human.create("John", 30)
print(Human.greet(john))
}
// Define variables before using them
var x = 3
var counter = 0
// If statements
if (x > 5) {
print("x is greater than 5")
} else if (x == 5) {
print("x equals 5")
} else {
print("x is less than 5")
}
// While loops
while (counter < 3) {
print("Counter: " + toString(counter))
counter = counter + 1
}
// For loops
for (var i = 0; i < 3; i = i + 1) {
print("Loop iteration: " + toString(i))
}
import "test/utils.bn"
fun main() {
var result = power(2, 3) // Using imported function
print("2^3 = " + toString(result))
}
print(value)
: Display values to consoletoString(value)
: Convert a value to stringinput(prompt)
: Read user input with a prompt
Check the test directory for example programs:
cmd/
: Command-line interfacepkg/
: Core packagesast/
: Abstract syntax tree definitionslexer/
: Tokenization of source codeparser/
: Parsing tokens into ASTtypechecker/
: Type checking systeminterpreter/
: Runtime execution
Contributions are welcome! Here's how you can contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please make sure your code follows the existing style and includes appropriate tests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors who have helped shape the Burn language
- Inspired by modern programming languages with clean syntax
- Until language is ready for Production only master branch will be used
- Post Production Language will be self hosted
- Documentaion of the entire language with its own website
- After Selfhosting Package Manager will be next and use of other packages will be possible
- ...