Quick Start Guide

Get started with B3D Programming Language in 10 minutes

Table of Contents

1. Installation

Option 1

Quick Install (Linux/macOS)

curl -sSL https://get.b3d.berkeai.com | bash
This command downloads and installs B3D automatically on your system.
Option 2

AppImage (Linux - Portable)

# Download AppImage wget https://b3d.berkeai.com/releases/v1.0.0/B3D-1.0.0-x86_64.AppImage # Make executable chmod +x B3D-1.0.0-x86_64.AppImage # Run B3D ./B3D-1.0.0-x86_64.AppImage --version
Option 3

DEB Package (Ubuntu/Debian)

# Download DEB package wget https://b3d.berkeai.com/releases/v1.0.0/b3d_1.0.0_amd64.deb # Install sudo dpkg -i b3d_1.0.0_amd64.deb # Verify installation b3d --version
✅ Verification: Run b3d --version to confirm installation was successful.

2. Your First Program

Step 1

Create a new file called hello.b3d

<Config> project_name = 'hello_world' version = '1.0.0' </Config> <Include> include std.io </Include> <Data> message = 'Hello, B3D World!' username = 'Developer' </Data> <Main> print(message) print('Welcome, {username}!') print('You are using B3D Programming Language') </Main>
Step 2

Run your program

b3d run hello.b3d
Expected Output:
Hello, B3D World!
Welcome, Developer!
You are using B3D Programming Language

3. Language Basics

Program Structure

Every B3D program follows this structured format:

<Config> // Project configuration and metadata project_name = 'my_project' version = '1.0.0' </Config> <Include> // Dependencies and imports include std.io include py:numpy // Python libraries </Include> <Data> // Global variables and data definitions name = 'Alice' age = 25 numbers = [1, 2, 3, 4, 5] </Data> <Main> // Your program logic goes here print('Program execution starts here') </Main>

Variables and Data Types

<Data> // Strings name = 'John Doe' message = "Hello World" // Numbers age = 30 pi = 3.14159 // Booleans is_active = true is_complete = false // Lists/Arrays fruits = ['apple', 'banana', 'orange'] numbers = [1, 2, 3, 4, 5] // Dictionaries person = { 'name': 'Alice', 'age': 28, 'city': 'New York' } </Data>

Functions

<Main> // Define a private function defne greet(name): { return 'Hello, {name}!' } // Define a public function (exportable) defni calculate_area(width, height): { return width * height } // Use functions greeting = greet('Alice') area = calculate_area(10, 5) print(greeting) print('Area: {area}') </Main>

4. Enhanced String Interpolation

B3D features powerful string interpolation with support for expressions:

<Data> name = 'Alice' age = 25 scores = [95, 87, 92] person = {'city': 'New York', 'country': 'USA'} </Data> <Main> // Basic interpolation print('Hello {name}!') // Expression interpolation print('Next year you will be {age + 1}') // Array access print('Your first score: {scores[0]}') // Complex expressions print('Average score: {(scores[0] + scores[1] + scores[2]) / 3}') // Dictionary access print('Location: {person["city"]}, {person["country"]}') // Function calls in strings print('Current time: {timestamp()}') </Main>

Control Structures

<Data> age = 20 numbers = [1, 2, 3, 4, 5] </Data> <Main> // Conditionals if (age >= 18): { print('You are an adult') } elif (age >= 13): { print('You are a teenager') } else: { print('You are a child') } // For loops for (number in numbers): { print('Processing: {number}') } // While loops counter = 0 while (counter < 3): { print('Counter: {counter}') counter = counter + 1 } // Special B3D loops loop(5, 1000): { // 5 iterations with 1 second delay print('Timed loop iteration: {loop_index}') } </Main>

5. Python Integration

B3D seamlessly integrates with the Python ecosystem:

<Include> include py:numpy include py:pandas include py:requests </Include> <Data> api_url = 'https://api.github.com/users/octocat' data_file = 'sample_data.csv' </Data> <Main> // Use NumPy for numerical computing numbers = numpy.array([1, 2, 3, 4, 5]) mean_value = numpy.mean(numbers) print('Mean: {mean_value}') // Use Pandas for data manipulation df = pandas.read_csv(data_file) print('Data shape: {df.shape}') // Use Requests for HTTP calls response = requests.get(api_url) if (response.status_code == 200): { data = response.json() print('User: {data["name"]}') } else: { print('API request failed') } </Main>

Python Code Converter

B3D includes a built-in Python-to-B3D converter:

# Convert Python code to B3D b3d convert "def greet(name): return f'Hello, {name}!'" # Interactive conversion b3d convert "for i in range(5): print(i)"

6. Interactive Features

Local Assistant

B3D includes a powerful local assistant (no internet required):

# Get help with language features b3d assist "explain variables" # Learn about functions b3d assist "write fibonacci function" # Get optimization tips b3d assist "optimize code performance" # Convert Python code b3d assist "convert python to b3d"

Interactive Shell

# Start interactive B3D shell b3d # In shell, you can: b3d> run hello.b3d b3d> assist explain loops b3d> convert "def hello(): print('Hi')" b3d> new my-project

🎉 Congratulations!

You've completed the B3D Quick Start Guide. Here's what to explore next:

📚 Interactive Tutorials 📖 Language Reference 💡 Code Examples 🐍 Python Integration

What You've Learned

  • ✅ How to install B3D
  • ✅ B3D program structure
  • ✅ Variables and data types
  • ✅ String interpolation
  • ✅ Control structures
  • ✅ Python integration
  • ✅ Local assistant features