Pebble is a lightweight, interpreted programming language designed for simplicity and extensibility. Built from the ground up in Go, it offers a familiar C-like syntax with powerful modern features.
Features • Installation • Usage • Roadmap
- Variables:
var x = 10; - Data Types: Integers, Booleans, Strings, Functions, Arrays, Hash Maps.
- Control Flow:
if/else,while,for. - Functions:
fn(x) { return x + 1; } - Built-ins:
print(),len(). - Embeddable: Can be used as a scripting language for Go applications.
Ensure you have Go installed.
git clone https://github.com/yourusername/pebble.git
cd pebblegraph TD
Source["Source Code (.pb)"] --> Lexer["Lexer (Lexical Analysis)"]
Lexer --> Tokens["Tokens"]
Tokens --> Parser["Parser (Syntactic Analysis)"]
Parser --> AST["Abstract Syntax Tree (AST)"]
AS["Abstract Syntax Tree (AST)"] --> Evaluator["Evaluator (Execution)"]
Evaluator --> Objects["Objects & Environment"]
Objects --> Output["Result / Side Effects"]
./pebble examples/demo.pbStart the interactive Read-Eval-Print-Loop:
go run cmd/pebble/main.goRun a Pebble script file:
go run cmd/pebble/main.go examples/demo.pbPebble is evolving! Here are the planned functionalities to transform it into a mid-level programming language:
- Advanced Control Flow:
switchstatements, andbreak/continuesupport. - Structs & Methods: Custom data types and object-oriented patterns for better data modeling.
- Modules & Imports: Support for multi-file projects and code reuse.
- Concurrency: Lightweight threads (fibers/goroutines) and channels for parallel execution.
- FFI (Foreign Function Interface): Ability to call Go or C functions directly from Pebble.
- Bytecode Compiler & VM: Performance optimizations through compilation to bytecode and a dedicated stack-based Virtual Machine. This approach can provide 10-50x performance improvements over the current tree-walk interpreter by reducing overhead and enabling better optimization opportunities. The implementation will maintain the existing AST evaluator logic while adding a compilation step to bytecode.
- Standard Library: Expanded built-in functions for Networking (HTTP), JSON/YAML parsing, and Math utilities.
- Package Manager: A dedicated tool for managing dependencies and modules.
- LSP Support: Language Server Protocol implementation for IDE integration (VS Code, etc.).
- Testing Framework: Built-in support for unit and integration tests.
- Improved Error Handling: Detailed error messages with line and column information for easier debugging.