- Genesis Programming Language
Genesis is currently in pre-1.0 development and is NOT production-ready. Many features are still being implemented and the language specification is subject to change. Use at your own risk and expect breaking changes.
Current Status: Version 0.9.4 - Active Development
- About
- Features
- Installation
- Quick Start
- Language Guide
- CLI Usage
- Standard Library
- Examples
- Roadmap
- Contributing
- License
Genesis is a general-purpose programming language designed with a focus on:
- Familiarity - C++-style syntax that's easy to learn for developers from C, C++, Java, or JavaScript backgrounds
- Type Safety - Stricter typing than JavaScript while maintaining simplicity
- JavaScript Integration - Transpiles to clean, readable JavaScript for seamless ecosystem integration
- No Runtime Overhead - Runs anywhere JavaScript runs (browsers, Node.js, Deno) without additional dependencies
Genesis combines the familiar syntax of compiled languages with the flexibility and ubiquity of JavaScript.
β
Static Typing - Declare variables with types (int, float, string, char, bool, double, void)
β
Functions - Full function support with typed parameters and return values
β
Control Flow - If/else statements and conditionals
β
Operators - Arithmetic, comparison, and logical operators
β
Built-in Functions - print() function for console output
β
Clean Transpilation - Generates readable, well-formatted JavaScript
β
CLI Tool - Command-line interface for building and running Genesis code
π§ Loops - For and while loops (parser support exists, transpiler in progress) π§ Arrays - Array types and operations π§ Classes - Object-oriented programming support π§ Modules - Import/export system π§ Standard Library - Comprehensive built-in utilities
npm install -g genesis-project
git clone https://github.com/Simpleboi/Genesis.git
cd Genesis
npm install
npm run build
npm linkCreate a file named hello.gen:
void greet(string name) { print("Hello, "); print(name); } int add(int x, int y) { return x + y; } greet("World"); int result = add(5, 3); print(result);
# Transpile to JavaScript genesis build hello.gen --out hello.js # Or transpile and run immediately genesis run hello.gen
Hello, World 8
Genesis requires explicit type declarations:
int age = 25; float price = 19.99; string name = "Alice"; bool isActive = true; double pi = 3.14159265359;
Transpiles to:
let age = 25; let price = 19.99; let name = "Alice"; let isActive = true; let pi = 3.14159265359;
Functions use C-style syntax with typed parameters and return types:
// Function with return value int multiply(int a, int b) { return a * b; } // Void function void sayHello(string name) { print("Hello, " + name); } // Function calls int product = multiply(4, 5); sayHello("Genesis");
Transpiles to:
function multiply(a, b) { return a * b; } function sayHello(name) { print("Hello, " + name); } let product = multiply(4, 5); sayHello("Genesis");
int x = 10; if (x > 5) { print("x is greater than 5"); } else { print("x is 5 or less"); }
int a = 10; int b = 20; int sum = a + b; int difference = a - b; int product = a * b; int quotient = b / a; bool isEqual = (a == b); bool isGreater = (a > b);
# Build (transpile) a Genesis file genesis build <file.gen> [--out <output.js>] # Run (transpile and execute) a Genesis file genesis run <file.gen> # Show version genesis --version # Show help genesis --help
# Transpile and save to file genesis build src/main.gen --out dist/main.js # Transpile and print to stdout genesis build src/main.gen # Transpile and run immediately genesis run src/main.gen
Genesis automatically injects essential built-in functions into all transpiled code.
Outputs values to the console.
print("Hello"); print("Sum:", 5 + 3);
Transpiles to:
console.log("Hello"); console.log("Sum:", 5 + 3);
More standard library functions coming soon!
int add(int a, int b) { return a + b; } int subtract(int a, int b) { return a - b; } int multiply(int a, int b) { return a * b; } int divide(int a, int b) { return a / b; } int x = 10; int y = 5; print("Addition:", add(x, y)); print("Subtraction:", subtract(x, y)); print("Multiplication:", multiply(x, y)); print("Division:", divide(x, y));
int max(int a, int b) { if (a > b) { return a; } else { return b; } } int larger = max(15, 20); print("The larger number is:", larger);
int square(int n) { return n * n; } int sumOfSquares(int a, int b) { return square(a) + square(b); } int result = sumOfSquares(3, 4); print("32 + 42 =", result); // Output: 25
More examples can be found in the src/examples/ directory.
- Basic lexer and parser
- Variable declarations with types
- Function declarations and calls
- Return statements
- If/else statements
- Binary expressions
- Built-in print function
- CLI tool
- While loops
- For loops
- Arrays and array operations
- String manipulation
- Type checking and validation
- Better error messages
- Comprehensive standard library
- Full test coverage
- Classes and objects
- Interfaces
- Generics
- Module system (import/export)
- Enums
- Switch statements
- Try/catch error handling
- Async/await support
- Package manager integration
- IDE support (syntax highlighting, LSP)
- Sourcemap generation
- Watch mode
- REPL (Read-Eval-Print Loop)
See Issues for detailed feature requests and bug reports.
Contributions are welcome! Genesis is an open-source project and we'd love your help.
Please read CONTRIBUTING.md for detailed guidelines on:
- Development setup
- Project architecture
- Coding standards
- Testing requirements
- Pull request process
- How to add new language features
Looking for a place to start? Check out issues tagged with good first issue.
Genesis is licensed under the ISC License.
Copyright (c) 2024 Nathaniel E. Paz Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
- GitHub: https://github.com/Simpleboi/Genesis
- Issues: https://github.com/Simpleboi/Genesis/issues
- Documentation: See CLAUDE.md for technical architecture details
- Contributing: See CONTRIBUTING.md for contribution guidelines
- Built with TypeScript
- CLI powered by Commander.js
- Tested with Jest
Made with β€οΈ by Nathaniel E. Paz
β Star this repository if you find it interesting!