{"id":28823894,"url":"https://github.com/byacherx/emlang","last_synced_at":"2026-04-24T20:34:20.464Z","repository":{"id":299695947,"uuid":"992864933","full_name":"ByaCherX/emlang","owner":"ByaCherX","description":"EMLang is a modern programming language designed for ease of use. It uses the LLVM backend and is written in C++. EMLang is an experimental language and should never be used in production.","archived":false,"fork":false,"pushed_at":"2025-06-17T20:58:06.000Z","size":242,"stargazers_count":0,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-17T21:30:57.826Z","etag":null,"topics":["cpp","language","llvm","llvm-ir"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ByaCherX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-29T20:47:54.000Z","updated_at":"2025-06-17T20:58:09.000Z","dependencies_parsed_at":"2025-06-17T21:34:19.536Z","dependency_job_id":"2776aca6-ae80-42c5-93d3-1c6fbed1ac67","html_url":"https://github.com/ByaCherX/emlang","commit_stats":null,"previous_names":["byacherx/emlang"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ByaCherX/emlang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByaCherX%2Femlang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByaCherX%2Femlang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByaCherX%2Femlang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByaCherX%2Femlang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ByaCherX","download_url":"https://codeload.github.com/ByaCherX/emlang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByaCherX%2Femlang/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260660097,"owners_count":23043487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","language","llvm","llvm-ir"],"created_at":"2025-06-19T01:02:01.223Z","updated_at":"2026-04-24T20:34:20.457Z","avatar_url":"https://github.com/ByaCherX.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![LLVM Logo](https://llvm.org/img/LLVMWyvernSmall.png)\n\n# EMLang [⚠️ Active development canceled]\n\n**A Modern Systems Programming Language with LLVM Backend**\n\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](#building)\n[![LLVM](https://img.shields.io/badge/LLVM-17+-blue.svg)](https://llvm.org/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![C++](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](#prerequisites)\n[![v1.0.0](https://img.shields.io/badge/EMLang_Version-1.0.0.alpha.9-purple.svg)](version)\n\nEMLang is a statically-typed systems programming language designed for high-performance applications with ahead-of-time (AOT) compilation using LLVM. It combines modern language features with C-like performance and memory control.\n\n\u003c/div\u003e\n\n\u003e [!Warning]\n\u003e **This language is not designed for production use, it is created for testing and learning purposes only.**\n\u003e - ⚠️ It is not recommended to use it in production systems.\n\u003e - 🔬 It is a work in progress and may not be fully functional or stable.\n\n---\n\n## 🚀 Project Overview\n\nEMLang provides a complete compiler pipeline with:\n- **Advanced Type System**: Comprehensive primitive types with Unicode support\n- **Memory Safety**: C-style pointers with semantic analysis\n- **LLVM Integration**: Native code generation with optimization\n- **Rich Standard Library**: I/O, string manipulation, math operations, and utilities\n\n### 📁 Project Structure\n\n```\nemlang/\n├── compiler/              # Complete compiler implementation\n│   ├── lexer/             # Lexical analyzer with Unicode support\n│   ├── parser/            # Recursive descent parser\n│   ├── ast/               # Abstract Syntax Tree with visitor pattern\n│   ├── semantic/          # Semantic analyzer with type checking\n│   └── codegen/           # LLVM IR code generator\n├── include/               # Public header files\n├── library/               # Comprehensive standard library\n│   ├── include/           # Library headers\n│   └── src/               # Library implementations\n├── src/                   # Main compiler and analysis tools\n├── tests/                 # Comprehensive test suite\n└── build/                 # Build artifacts and executables\n```\n\n## ✨ Language Features\n\n### **Primitive Types**\n\n| Type     | Size   | Description      | Min Value | Max Value |\n|----------|--------|------------------|-----------|-----------|\n| `int8`   | 8-bit  | Signed integer   | -128 | 127 |\n| `int16`  | 16-bit | Signed integer   | -32,768 | 32,767 |\n| `int32`  | 32-bit | Signed integer   | -2,147,483,648 | 2,147,483,647 |\n| `int64`  | 64-bit | Signed integer   | -9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 |\n| `uint8`  | 8-bit  | Unsigned integer | 0 | 255 |\n| `uint16` | 16-bit | Unsigned integer | 0 | 65,535 |\n| `uint32` | 32-bit | Unsigned integer | 0 | 4,294,967,295 |\n| `uint64` | 64-bit | Unsigned integer | 0 | 18,446,744,073,709,551,615 |\n| `float`  | 32-bit | Floating point   | ~-3.4e38 | ~3.4e38 |\n| `double` | 64-bit | Double precision | ~-1.8e308 | ~1.8e308 |\n| `bool`   | 1-bit  | Boolean          | `false` | `true` |\n| `char`   | 8-bit  | Character        | 0 | 255 |\n\n### **Unicode and String Support**\n\n| Feature                | Description | Examples |\n|------------------------|-------------|----------|\n| **Unicode Characters** | Full UTF-8 character support | `'😀'`, `'π'`, `'€'` |\n| **Escape Sequences**   | Standard C-style escapes | `'\\n'`, `'\\t'`, `'\\\\'`, `'\\\"'` |\n| **Unicode Escapes**    | Unicode code point notation | `'\\u{03C0}'` (π), `'\\u{20AC}'` (€) |\n| **String Literals**    | UTF-8 string support | `\"Hello, World!\"` |\n| **Path Strings**       | Windows/Unix path support | `\"C:\\\\Users\\\\Name\"` |\n| **Mixed Content**      | Unicode in strings | `\"Càf Manü ★ ♠ ♥\"` |\n\n### **C-Style Pointer System**\n\n| Feature | Operator | Description | Usage |\n|---------|----------|-------------|-------|\n| **Address-of** | `\u0026` | Gets memory address | `\u0026variable` |\n| **Dereference** | `*` | Accesses value at address | `*pointer` |\n| **Pointer Declaration** | `*` | Declares pointer type | `int32*` |\n| **Multi-level Pointers** | `**` | Pointer to pointer | `int32**` |\n| **Null Pointer** | `null` | Null pointer value | `ptr = null` |\n\n### **Function Declarations**\n\n| Feature | Syntax | Description | Example |\n|---------|--------|-------------|---------|\n| **Function Definition** | `function name(): type` | Regular function | `function add(a: int32, b: int32): int32` |\n| **External Functions** | `extern function` | External C functions | `extern function printf(format: str): int32` |\n| **Void Functions** | `: void` | No return value | `function print(): void` |\n| **Parameters** | `name: type` | Typed parameters | `(x: int32, y: float)` |\n| **Return Statement** | `return value` | Function return | `return x + y` |\n\n### **Control Flow**\n\n| Structure | Syntax | Description | Features |\n|-----------|--------|-------------|----------|\n| **If Statement** | `if (condition) { }` | Conditional execution | With optional `else` |\n| **While Loop** | `while (condition) { }` | Pre-condition loop | Condition checked first |\n| **For Loop** | `for (init; condition; update)` | Counting loop | C-style syntax |\n| **Block Scope** | `{ ... }` | Code blocks | Local variable scope |\n| **Nested Structures** | - | All structures nestable | Unlimited nesting depth |\n\n\n## 🏗️ Architecture \u0026 Implementation\n\n### ✅ **Lexical Analysis**\n- **Unicode-aware tokenization** with full UTF-8 support\n- **Escape sequence processing** for strings and characters\n- **Multi-line and single-line comments**\n- **Comprehensive operator recognition**\n\n### ✅ **Syntax Analysis** \n- **Recursive descent parser** with operator precedence\n- **Complete AST node hierarchy** with visitor pattern\n- **Error recovery** and synchronization\n- **Lookahead disambiguation**\n\n### ✅ **Semantic Analysis**\n- **Hierarchical symbol tables** with scope management\n- **Static type checking** with type inference\n- **Pointer type validation** and safety analysis\n- **Function signature verification**\n\n### ✅ **Code Generation**\n- **LLVM IR generation** for all language constructs\n- **Type mapping** from EMLang to LLVM types\n- **Memory management** with stack allocation\n- **Optimization passes** integration\n\n### 📚 **Standard Library**\n\u003e [!Warning]\n\u003e The emlang standard library is not available at the moment. It will be available in beta.\nThe library provides essential functionality across multiple domains:\n\n- **I/O Operations**: `emlang_print_*`, `emlang_read_*`, console control\n- **String Manipulation**: `emlang_strlen`, `emlang_strcmp`, case conversion\n- **Mathematical Functions**: `emlang_pow`, `emlang_sqrt`, trigonometry\n- **Memory Management**: `emlang_malloc`, `emlang_free`, `emlang_memset`\n- **Utility Functions**: Array operations, bit manipulation, hashing\n\n## 🔧 Building \u0026 Installation\n\n### Prerequisites\n- **CMake** 3.10 or higher\n- **C++17** compatible compiler (GCC 9+, Clang 8+, MSVC 2017+)\n- **LLVM** 14+ (automatically detected, enables code generation)\n- **Git** for cloning and version control\n\n### 🏗️ Build Process\n\n#### Windows (Visual Studio)\n```powershell\n# Clone the repository\ngit clone https://github.com/ByaCherX/emlang.git\ncd emlang\n\n# Create build directory\nmkdir build\ncd build\n\n# Configure with CMake\ncmake .. -G \"Visual Studio 17 2022\" -A x64\n\n# Build the project\ncmake --build . --config Release\n\n# Run tests\n./Release/emlang_check.exe ../tests/simple_types_test.em\n```\n\n#### Linux/macOS\n```bash\n# Clone and build\ngit clone https://github.com/ByaCherX/emlang.git\ncd emlang\n\n# Create and enter build directory\nmkdir build \u0026\u0026 cd build\n\n# Configure and build\ncmake .. -DCMAKE_BUILD_TYPE=Release\nmake -j$(nproc)\n\n# Install (optional)\nsudo make install\n```\n\n### 📦 Build Targets\n\n- **`emlang`** - Main compiler executable\n- **`emlang_check`** - AST and token analysis tool\n- **`emlang_compiler`** - Compiler library (DLL/shared object)\n- **`emlang_lib`** - Standard library (optional, requires LLVM)\n\n## 🚀 Usage \u0026 Examples\n\n### Basic Compilation\n```bash\n# Compile EMLang source to object file\n./emlang source.em\n\n# Generate LLVM IR\n./emlang --emit-llvm source.em -o output.ll\n\n# Analyze source code structure\n./emlang_check --ast --tokens source.em\n```\n\n### 📝 Language Examples\n\n\u003e [!Note]\n\u003e Pointers are experimental, define a CMAKE Flag to enable them.\n\n#### Complete Program\n```emlang\nextern function printf(format: str): int32;\n\nfunction factorial(n: int32): int32 {\n    if (n \u003c= 1) {\n        return 1;\n    }\n    return n * factorial(n - 1);\n}\n\nfunction main(): int32 {\n    let number: int32 = 5;\n    let result: int32 = factorial(number);\n    \n    printf(\"Factorial of %d is %d\\n\");\n    return 0;\n}\n```\n\n#### Pointer Operations\n```emlang\nfunction swapIntegers(a: int32*, b: int32*): void {\n    let temp: int32 = *a;\n    *a = *b;\n    *b = temp;\n}\n\nfunction main(): int32 {\n    let x: int32 = 10;\n    let y: int32 = 20;\n    \n    swapIntegers(\u0026x, \u0026y);\n    // x is now 20, y is now 10\n    \n    return 0;\n}\n```\n\n#### String and Character Processing\n```emlang\nfunction stringDemo(): void {\n    let greeting: str = \"Hello, 世界! 🌍\";\n    let firstChar: char = 'H';\n    let unicode: char = '\\u{1F30D}';  // 🌍\n    \n    // String escape sequences\n    let formatted: str = \"Line 1\\nLine 2\\t\\\"Quoted\\\"\";\n    let path: str = \"C:\\\\Program Files\\\\EMLang\";\n}\n```\n\n### 🔍 Analysis Tools\n\n#### Token Analysis\n```bash\n$ ./emlang_check --tokens simple_test.em\n=== TOKENS ===\nFUNCTION function 1:1\nIDENTIFIER main 1:10\nLEFT_PAREN ( 1:14\nRIGHT_PAREN ) 1:15\nCOLON : 1:16\nINT32 int32 1:18\nLEFT_BRACE { 1:24\n...\n```\n\n#### AST Visualization\n```md\n$ ./emlang_check --ast simple_test.em\n=== AST ===\nProgram\n \\-stmt0:   ExternFunctionDecl \u003cline:3, col:17\u003e name='emlang_print_int' return='void'\n   \\-param0: value: int32\n \\-stmt1:   ExternFunctionDecl \u003cline:4, col:17\u003e name='emlang_print_str' return='void'\n   \\-param0: str_param: char*\n \\-stmt2:   ExternFunctionDecl \u003cline:5, col:17\u003e name='emlang_println' return='void'\n \\-stmt3:   FunctionDecl name='main' return='int32'\n   \\-body:     BlockStmt \u003cline:7, col:24\u003e\n     \\-stmt0:       VarDecl \u003cline:9, col:9\u003e let x type='int32'\n       \\-init:         LiteralExpr \u003cline:9, col:20\u003e value='10'\n     \\-stmt1:       ExprStmt\n       \\-expr:         FunctionCallExpr \u003cline:10, col:5\u003e name='emlang_print_str'\n         \\-arg0:           LiteralExpr \u003cline:10, col:22\u003e value='Initial x value: '\n     \\-stmt2:       ExprStmt\n       \\-expr:         FunctionCallExpr \u003cline:11, col:5\u003e name='emlang_print_int'\n         \\-arg0:           IdentifierExpr \u003cline:11, col:22\u003e name='x'\n     \\-stmt3:       ExprStmt\n       \\-expr:         FunctionCallExpr \u003cline:12, col:5\u003e name='emlang_println'\n     \\-stmt4:       ExprStmt\n       \\-expr:         AssignmentExpr\n         \\-target:          IdentifierExpr \u003cline:15, col:5\u003e name='x'\n         \\-value:           LiteralExpr \u003cline:15, col:9\u003e value='20'\n     \\-stmt5:       ExprStmt\n       \\-expr:         FunctionCallExpr \u003cline:16, col:5\u003e name='emlang_print_str'\n         \\-arg0:           LiteralExpr \u003cline:16, col:22\u003e value='After assignment x = 20: '\n     \\-stmt6:       ExprStmt\n       \\-expr:         FunctionCallExpr \u003cline:17, col:5\u003e name='emlang_print_int'\n         \\-arg0:           IdentifierExpr \u003cline:17, col:22\u003e name='x'\n     \\-stmt7:       ExprStmt\n       \\-expr:         FunctionCallExpr \u003cline:18, col:5\u003e name='emlang_println'\n     \\-stmt8:       ReturnStmt \u003cline:20, col:5\u003e\n       \\-value:         LiteralExpr \u003cline:20, col:12\u003e value='0'\n```\n\n### 🚨 Error Reporting\n\nEMLang provides comprehensive error diagnostics:\n\n```\nSemantic Error at 7:15 - Type mismatch: cannot assign 'str' to 'int32'\nSemantic Error at 12:8 - Variable 'undeclared' not found in current scope  \nSemantic Error at 18:23 - Function 'unknown' is not declared\nParse Error at 25:1 - Expected ';' after expression statement\n```\n\n## 🧪 Testing \u0026 Validation\n\n### Test Suite Coverage\n- **✅ Basic Types**: `simple_types_test.em`\n- **✅ Unicode Characters**: `char_string_test.em`, `advanced_char_test.em`\n- **✅ Pointer Operations**: `simple_pointer_test.em`, `multilevel_pointer_test.em`\n- **✅ External Functions**: `extern_function_test.em`, `simple_extern_test.em`\n- **✅ Integration**: `phase2_integration_test.em`, `phase3_pointer_test.em`\n- **✅ Error Detection**: `error_test.em`\n\n### Running Tests\n```bash\n# Run all tests\ncd tests\nfor test in *.em; do\n    echo \"Testing $test\"\n    ../build/Debug/emlang_check \"$test\"\ndone\n\n# Individual test analysis\n./build/Debug/emlang_check --all tests/phase3_pointer_test.em\n```\n\n## 🤝 Contributing\n\nWe welcome contributions to EMLang! Here's how you can help:\n\n### 🐛 **Bug Reports**\n- Use GitHub Issues to report bugs\n- Include minimal reproduction code\n- Specify your operating system and compiler version\n\n### ✨ **Feature Requests**\n- Propose new language features through GitHub Issues\n- Provide use cases and examples\n- Consider implementation complexity\n\n### 💻 **Code Contributions**\n1. **Fork** the repository\n2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)\n3. **Commit** your changes (`git commit -m 'Add amazing feature'`)\n4. **Push** to the branch (`git push origin feature/amazing-feature`)\n5. **Open** a Pull Request\n\n### 📋 **Development Guidelines**\n- Follow the existing code style and conventions\n- Add tests for new features\n- Update documentation for API changes\n- Ensure all tests pass before submitting\n\n### 🔍 **Areas Needing Help**\n- **Standard Library**: Expand mathematical and utility functions\n- **Error Messages**: Improve error reporting and suggestions\n- **Optimization**: LLVM optimization pass integration\n- **Documentation**: API documentation and tutorials\n- **Testing**: Additional test cases and edge cases\n\n## 📄 License\nEMLang is released under the **MIT License**. See [LICENSE](LICENSE) file for details.\n\n---\n\n## 🔗 Links \u0026 Resources\n\n- **🐛 Issue Tracker**: [GitHub Issues](https://github.com/ByaCherX/emlang/issues)\n- **💬 Discussions**: [GitHub Discussions](https://github.com/ByaCherX/emlang/discussions)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Built with ❤️ using LLVM**\n\n*EMLang - Where Performance Meets Productivity*\n\n[⭐ Star us on GitHub](https://github.com/ByaCherX/emlang) | [🍴 Fork the Project](https://github.com/ByaCherX/emlang/fork) | [📝 Report Issues](https://github.com/ByaCherX/emlang/issues)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyacherx%2Femlang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyacherx%2Femlang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyacherx%2Femlang/lists"}