A modern, expressive programming language built with Python and LLVM, featuring unique syntax and powerful compilation capabilities.
- Modern Syntax: Clean, expressive syntax with unique language constructs
- LLVM Backend: High-performance compilation using LLVM infrastructure
- Strong Typing: Static type system with explicit type annotations
- Multiple Execution Modes: Direct execution, compilation, and debugging options
- Cross-Platform: Works on Windows, Linux, and macOS
- Built-in Functions: Printf, mathematical operations, and more
- Control Flow: Support for loops, conditionals, and function calls
- Import System: Modular code organization with file imports
- Python 3.12+
- Conda (recommended for environment management)
-
Clone the repository
git clone https://github.com/yourusername/lime-programming-language-built-using-python.git cd lime-programming-language-built-using-python -
Set up the environment
conda create -n lime python=3.12 conda activate lime pip install llvmlite
-
Run your first Lime program
# Windows Command Prompt lime.bat tests/ifAndBoolean.lime # Windows PowerShell ./lime.ps1 tests/ifAndBoolean.lime # Direct Python execution python main.py tests/ifAndBoolean.lime
fn main() -> int {
printf("Hello, Lime! π\n");
return 0;
}
fn main() -> int {
let a: int = 10; ... standard declaration ...
lit b: int be 15 rn ... alternative syntax ...
let pi: float = 3.14159;
return a + b;
}
... Standard function declaration ...
fn add(a: int, b: int) -> int {
return a + b;
}
... Alternative function syntax ...
bruh multiply(a: int, b: int) -> int {
pause a * b rn ... pause = return, rn = statement end ...
}
fn main() -> int {
printf("5 + 3 = %i\n", add(5, 3));
printf("4 * 7 = %i\n", multiply(4, 7));
return 0;
}
fn main() -> int {
let count: int = 0;
... While loop ...
while count < 5 {
printf("Count: %i\n", count);
count = count + 1;
}
... For loop ...
for (let i: int = 0; i < 3; i++) {
printf("Iterator: %i\n", i);
}
... Conditional statements ...
if count == 5 {
printf("Reached target count!\n");
} else {
printf("Count mismatch!\n");
}
return count;
}
... This is a single-line comment ...
...
Multi-line comments
span multiple lines
like this
...
fn main() -> int {
let x: int = 42; ... inline comment ...
return x;
}
import "math.lime"
fn main() -> int {
let result: int = add(5, 10); ... function from math.lime ...
return result;
}
lime.bat program.lime # Run program
lime.bat program.lime --debug-lexer # Debug lexer output
lime.bat program.lime --debug-parser # Debug parser output
lime.bat program.lime --debug-compiler # Debug compiler output
lime.bat program.lime --no-run # Compile only, don't execute--debug-lexer: Shows tokenization process--debug-parser: Outputs AST todebug/ast.json--debug-compiler: Outputs LLVM IR todebug/ir.ll--no-run: Compile without execution
lime-programming-language/
βββ π main.py # Entry point and CLI interface
βββ π§ lime_lexer.py # Tokenization and lexical analysis
βββ ποΈ lime_parser.py # Syntax parsing and AST generation
βββ π³ lime_ast.py # Abstract Syntax Tree definitions
βββ π·οΈ lime_token.py # Token definitions and types
βββ βοΈ compiler.py # LLVM IR generation and compilation
βββ π environment.py # Variable and function scope management
βββ π¦ lime.bat # Windows batch launcher
βββ π» lime.ps1 # PowerShell launcher
βββ π tests/ # Example Lime programs
β βββ ifAndBoolean.lime
β βββ whileLoop.lime
β βββ math.lime
β βββ string.lime
β βββ ...
βββ π assets/ # Resources and icons
βββ π debug/ # Debug output files
βββ π dist/ # Distribution builds
fn fibonacci(n: int) -> int {
if n <= 1 {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}
fn main() -> int {
printf("Fibonacci(10) = %i\n", fibonacci(10));
return 0;
}
fn main() -> int {
let name: string = "Lime";
let version: float = 0.1;
printf("Welcome to %s v%.1f! π\n", name, version);
return 0;
}
Lime follows a traditional compiler pipeline:
-
Lexical Analysis (
lime_lexer.py)- Tokenizes source code into meaningful symbols
- Handles keywords, operators, literals, and identifiers
-
Syntax Analysis (
lime_parser.py)- Builds Abstract Syntax Tree (AST) from tokens
- Implements recursive descent parsing
- Handles operator precedence and associativity
-
Code Generation (
compiler.py)- Translates AST to LLVM Intermediate Representation
- Performs type checking and optimization
- Generates executable machine code
-
Runtime Environment (
environment.py)- Manages variable and function scopes
- Handles symbol resolution and type information
- Variable declarations and assignments
- Arithmetic and logical operations
- Function definitions and calls
- Control flow (if/else, while, for loops)
- Type system (int, float, string)
- Comments (single and multi-line)
- Import system for modular code
- Printf for formatted output
- LLVM-based compilation
- Arrays and data structures
- Object-oriented programming
- Advanced type inference
- Standard library expansion
- Package manager integration
- IDE support and language server
The project can be distributed as:
- Batch File:
lime.bat(Windows CMD) - PowerShell Script:
lime.ps1(Windows PowerShell) - Directory Distribution:
dist/lime/(Standalone executable)
See DISTRIBUTION.md for detailed distribution information.
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests in the
tests/directory - Test your changes:
lime.bat tests/your-test.lime - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
# Clone and setup
git clone https://github.com/yourusername/lime-programming-language.git
cd lime-programming-language-built-using-python
# Install development dependencies
conda create -n lime-dev python=3.12
conda activate lime-dev
pip install llvmlite pytest
# Run tests
python main.py tests/test.limeLime leverages LLVM for high-performance compilation:
- Compilation Speed: Fast parsing and AST generation
- Runtime Performance: LLVM-optimized executable code
- Memory Efficiency: Static typing enables optimization
- Debugging Support: Rich debug information and error reporting
- LLVM Project: For the powerful compilation infrastructure
- Python Community: For the excellent development ecosystem
- Contributors: Everyone who has contributed to this project
Made by passionate developers for the programming community
Learn More: [Watch Lime Programming Language Playlist](https://youtube.com/playlist?list=PLCJHRjnsxJFoK8e-RaNZUa7R4BaPqczHX)