LLM.lang is a programming language specifically designed for Large Language Models (LLMs). It combines the best features of popular programming languages with novel constructs that leverage the unique capabilities of LLMs, creating a language that is both powerful and intuitive for AI-driven development.
# Clone the repository
git clone https://github.com/llm-lang/llm.lang.git
cd llm.lang
# Build the project
cargo build --release
# Run an example
./scripts/run_example.sh examples/hello_world.llm
# Try the features demonstration
./scripts/run_example.sh examples/llm_features.llm
# Start the interactive interpreter
./target/release/llmi -i
For more detailed instructions, see the Getting Started Guide.
LLM.lang inherently understands and maintains context across the program:
// Create a context
with context "UserAuthentication" {
var user = authenticateUser();
var token = generateToken();
}
// Later, access the context by name
within "UserAuthentication" {
validateToken(token); // token is accessible here
}
Store and recall values across different parts of your program:
// Remember a value
@remember currentUser = getUserProfile();
// Later, recall the value without explicit reference
var profile = @recall; // Retrieves currentUser
Express complex operations using natural language:
// Natural language query
var users = #"Find all users who signed up in the last 7 days"#;
// Intent-based programming
intent: create a user authentication system;
Define functions and transformations by examples:
// Define a function by examples
examples for capitalize {
"hello" -> "Hello";
"world" -> "World";
}
// Use the function
print(capitalize("llm.lang")); // Outputs: "Llm.lang"
Express multiple solution approaches simultaneously:
// Execute multiple approaches in parallel
var result = parallel {
path1: {
// First approach
return approach1();
}
path2: {
// Second approach
return approach2();
}
} select best; // Choose the best result
Work with semantic embeddings and thought vectors:
// Create vector embeddings
vector concept1 = embed("database optimization");
vector concept2 = embed("query performance");
// Combine vectors
vector combined = concept1 * 0.7 + concept2 * 0.3;
// Apply the vector to guide content generation
apply combined to {
// This block is influenced by the combined vector
optimizeDatabaseQueries();
}
# Clone the repository
git clone https://github.com/llm-lang/llm.lang.git
cd llm.lang
# Build the project
cargo build --release
# Add to your PATH
export PATH=$PATH:$(pwd)/target/release
Create a file named hello.llm
:
context MainProgram {
fn main() {
print("Hello, World from LLM.lang!");
}
}
Run the program:
llmi hello.llm
Check out the examples/
directory for more sample programs:
examples/hello_world.llm
: Basic language featuresexamples/applications/data_analysis.llm
: A data analysis applicationexamples/applications/web_server.llm
: A simple web serverexamples/applications/nlp_processor.llm
: Natural language processing
- Language Specification
- Implementation Roadmap
- Core Components
- Code Examples
- Standard Library
- Prototype Implementation Plan
- Project Structure
- Debugger Instructions
LLM.lang includes a VSCode debugger extension that allows you to debug your LLM.lang programs. The debugger supports:
- Setting breakpoints
- Stepping through code
- Inspecting variables
- Evaluating expressions
- Viewing the call stack
To use the debugger:
-
Build the required components:
# Build the debug adapter cargo build --release -p llm_lang_dap # Build the language server cargo build --release -p llm_lang_lsp
-
Launch VSCode with the LLM.lang extension:
./launch_vscode.sh
-
Open an LLM.lang file, set breakpoints, and press F5 to start debugging.
For detailed instructions, see the Debugger Instructions.
Traditional programming languages were designed for human programmers, with syntax and semantics optimized for human cognition. LLM.lang takes a different approach, designing a language that leverages the unique capabilities of Large Language Models while remaining readable and usable by humans.
Key advantages include:
- Contextual Programming: Maintain and switch between different contexts naturally
- Semantic Understanding: Work with meaning rather than just syntax
- Natural Language Integration: Express complex operations in natural language
- Example-Driven Development: Define behavior through examples
- Parallel Reasoning: Express multiple solution approaches simultaneously
- Concept Manipulation: Work with semantic embeddings and thought vectors
LLM.lang is licensed under the MIT License. See LICENSE for details.
LLM.lang draws inspiration from many programming languages and paradigms, including:
- Python's readability and simplicity
- JavaScript's flexibility and functional features
- Rust's type system and safety
- Prolog's logic programming
- Lisp's metaprogramming
- Natural language processing techniques
- Vector-based semantic representations