{"id":32398988,"url":"https://github.com/tinybiggames/blaisepascal","last_synced_at":"2025-10-25T08:15:48.856Z","repository":{"id":320644638,"uuid":"1082831244","full_name":"tinyBigGAMES/BlaisePascal","owner":"tinyBigGAMES","description":"Open-source Pascal-to-C++ transpiler with Pascal semantic compatibility. Self-contained distribution with bundled Zig compiler and runtime. Think in Pascal. Compile to C++","archived":false,"fork":false,"pushed_at":"2025-10-25T00:04:48.000Z","size":641,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T01:21:39.214Z","etag":null,"topics":["clang","cpp","cross-platform","delphi","pascal","transpiler","zig"],"latest_commit_sha":null,"homepage":"https://blaisepascal.dev","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinyBigGAMES.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"tinyBigGAMES","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-10-24T20:53:03.000Z","updated_at":"2025-10-24T23:51:02.000Z","dependencies_parsed_at":"2025-10-25T01:32:33.521Z","dependency_job_id":null,"html_url":"https://github.com/tinyBigGAMES/BlaisePascal","commit_stats":null,"previous_names":["tinybiggames/blaisepascal"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tinyBigGAMES/BlaisePascal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FBlaisePascal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FBlaisePascal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FBlaisePascal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FBlaisePascal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinyBigGAMES","download_url":"https://codeload.github.com/tinyBigGAMES/BlaisePascal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FBlaisePascal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280924012,"owners_count":26414356,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["clang","cpp","cross-platform","delphi","pascal","transpiler","zig"],"created_at":"2025-10-25T08:15:47.748Z","updated_at":"2025-10-25T08:15:48.848Z","avatar_url":"https://github.com/tinyBigGAMES.png","language":"Pascal","readme":"![Blaise Pascal](media/blaise.png)\n  [![Chat on Discord](https://img.shields.io/discord/754884471324672040?style=for-the-badge)](https://discord.gg/tPWjMwK) [![Follow on Bluesky](https://img.shields.io/badge/Bluesky-tinyBigGAMES-blue?style=for-the-badge\u0026logo=bluesky)](https://bsky.app/profile/tinybiggames.com) \n\n# Blaise Pascal™\n\n**Think in Pascal. Compile to C++.**\n\nAn open-source Pascal-to-C++ transpiler with perfect Delphi semantic compatibility. Self-contained distribution with bundled Zig compiler and complete runtime library.\n\n## 🎩 Why \"Blaise Pascal\"?\n\nNamed after the 17th-century French polymath Blaise Pascal—mathematician, physicist, and inventor of one of the first mechanical calculators—and the programming language that bears his name. Like its namesakes, Blaise Pascal™ embodies clarity, elegance, and the marriage of theoretical beauty with practical innovation. We honor Pascal's legacy by keeping the Pascal language alive and thriving in the modern age.\n\n## ✨ Features\n\n- **🎯 Pascal Dialect** - A modern Pascal dialect compatible with Delphi where possible. Transpiles fundamental Pascal syntax with clean, predictable C++ output. Best thought of as its own flavor of Pascal optimized for C++ compilation.\n\n- **⚡ Modern C++23** - Generates clean C++23 code with modern LLVM backend. Leverages spaceship operator, std::format, and std::println for optimal performance.\n\n- **🏗️ Smart Architecture** - Dumb transpiler, smart runtime. Simple token mapping keeps the transpiler maintainable while a sophisticated runtime preserves exact Pascal semantics.\n\n- **📦 Self-Contained** - Everything included - Blaise transpiler, Zig compile, and complete runtime library. Just unzip and go, no additional downloads needed.\n\n- **🌍 Cross-Platform** - Compile for Windows, Linux, and macOS from any platform using bundled Zig build system with consistent behavior everywhere.\n\n- **🔒 Zero Conflicts** - All runtime code in `bp` namespace with fully-qualified names. Perfect isolation from external libraries like raylib, SDL, OpenGL.\n\n## 🚀 Quick Start\n\n### 1. Download \u0026 Extract\n\nDownload the latest release and extract to any directory. Everything you need is included:\n- `Blaise.exe` - The transpiler\n- `bin/res/zig/` - Zig compiler with LLVM\n- `bin/res/runtime/` - C++ Pascal runtime library\n\n### 2. Create a New Project\n\n```bash\n# Create a new program project\nblaise.exe init MyProgram\n\n# Or create a library project\nblaise.exe init MyLib --template library\n```\n\n### 3. Write Your Pascal Code\n\nEdit the generated source file in `src/MyProgram.pas`:\n\n```pascal\nprogram MyProgram;\nbegin\n  WriteLn('Hello from Blaise Pascal!');\nend.\n```\n\n### 4. Build \u0026 Run\n\n```bash\n# Navigate to your project directory\ncd MyProgram\n\n# Build the project (transpile + compile)\nblaise.exe build\n\n# Run the compiled executable\nblaise.exe run\n```\n\n## 📝 Usage\n\n### Basic Commands\n\n```bash\nblaise init \u003cname\u003e [--template \u003ctype\u003e]  # Create new project\nblaise build                             # Build project\nblaise run                               # Run executable\nblaise clean                             # Clean build artifacts\nblaise zig \u003cargs\u003e                        # Pass args to Zig compiler\nblaise version                           # Show version\nblaise help                              # Show help\n```\n\n### Project Templates\n\n- `program` - Executable program (default)\n- `library` - Shared library (.dll on Windows, .so on Linux)\n- `unit` - Static library (.lib on Windows, .a on Linux)\n\n## 🎛️ Compiler Directives\n\nControl your build settings using compiler directives in your Pascal source:\n\n### Cross-Platform Compilation\n\n```pascal\n{$TARGET x86_64-linux}\nprogram MyProgram;\nbegin\n  WriteLn('Cross-platform!');\nend.\n```\n\n**Supported targets:**\n- `{$TARGET x86_64-windows}` - Windows 64-bit\n- `{$TARGET x86_64-linux}` - Linux 64-bit\n- `{$TARGET aarch64-macos}` - macOS ARM64\n- `{$TARGET native}` - Current platform (default)\n\n### Optimization Levels\n\n```pascal\n{$OPTIMIZATION Debug}        // Debug build (default)\n{$OPTIMIZATION ReleaseSafe}  // Safe optimized build\n{$OPTIMIZATION ReleaseFast}  // Fast optimized build\n{$OPTIMIZATION ReleaseSmall} // Size optimized build\n```\n\n### Application Type (Windows)\n\n```pascal\n{$APPTYPE GUI}      // No console window\n{$APPTYPE CONSOLE}  // Console application (default)\n```\n\n### External Libraries\n\n```pascal\n{$INCLUDE_HEADER \u003craylib.h\u003e}\n{$LIBRARY_PATH .\\lib}\n{$LINK raylib.lib}\n```\n\n## 🏗️ Architecture\n\n### THE LAW\n\n```\n╔═══════════════════════════════════════════════════════════════╗\n║                                                               ║\n║  WRAP EVERYTHING THAT CAN BE WRAPPED IN THE C++ RUNTIME       ║\n║                                                               ║\n║  Make the transpiler DUMB.                                    ║\n║  Make the runtime SMART.                                      ║\n║                                                               ║\n║  All runtime lives in namespace bp { ... }                    ║\n║  ALWAYS use fully-qualified names: bp::Integer, bp::WriteLn   ║\n║  NEVER use 'using namespace bp;'                              ║\n║                                                               ║\n╚═══════════════════════════════════════════════════════════════╝\n```\n\n### Three-Layer Design\n\n```\nPascal Source (.pas)\n        ↓\n    DelphiAST (parsing)\n        ↓\n  Blaise Transpiler (token mapping)\n        ↓\n  Generated C++23 (.cpp)\n        ↓\n    Zig/LLVM (compilation)\n        ↓\n   Native Executable\n```\n\n**The transpiler is a dumb token mapper** - It walks the AST and maps Pascal tokens to C++ tokens with `bp::` prefixes. That's it.\n\n**All semantic complexity lives in the C++23 runtime** - The `bp` namespace contains wrapped types, operators, and Pascal RTL functions that preserve exact Pascal semantics.\n\n## 📚 Language Coverage\n\n### Core Types\n- Integer, Cardinal, Int64, UInt64\n- Boolean, Char, String (UTF-16, 1-based indexing)\n- Single, Double, Extended\n- Records, Enumerations\n- Arrays (static \u0026 dynamic), Sets, Pointers\n\n### Control Flow\n- `if..then..else`\n- `while..do`, `repeat..until`\n- `for..to..do`, `for..downto..do`\n- `case..of..else`\n- `break`, `continue`, `exit`\n\n### Operators\n- Arithmetic: `+`, `-`, `*`, `/`, `div`, `mod`\n- Comparison: `=`, `\u003c\u003e`, `\u003c`, `\u003e`, `\u003c=`, `\u003e=`\n- Logical: `and`, `or`, `not`, `xor`\n- Bitwise: `shl`, `shr`\n- Set operations: `in`\n- Pointers: `@`, `^`\n\n### Program Types\n- Programs (executables)\n- Units (modules)\n- Libraries (DLLs/shared objects)\n- Uses clause, Exports clause\n- Initialization/Finalization\n\n### Exception Handling\n- `try..except..end`\n- `try..finally..end`\n- Exception types and messages\n\n### Runtime Library\n- I/O: `WriteLn`, `Write`, `ReadLn`, `Read`, File I/O\n- Strings: `Length`, `Pos`, `Copy`, `UpperCase`, `LowerCase`, `Trim`\n- Conversions: `IntToStr`, `StrToInt`, `FloatToStr`, `StrToFloat`\n- Math: `Abs`, `Sqrt`, `Sin`, `Cos`, `Tan`, `Round`, `Trunc`\n- Memory: `GetMem`, `FreeMem`, `New`, `Dispose`\n- System: `ParamCount`, `ParamStr`, `Halt`\n- And much more...\n\n## 💡 Example\n\n**Pascal Source:**\n```pascal\nprogram Hello;\nvar\n  name: String;\n  age: Integer;\nbegin\n  name := 'World';\n  age := 42;\n  \n  WriteLn('Hello, ', name, '!');\n  WriteLn('Age: ', age);\nend.\n```\n\n**Generated C++23:**\n```cpp\n#include \"runtime.h\"\n\nvoid ProgramMain() {\n    bp::String name;\n    bp::Integer age;\n    \n    name = \"World\";\n    age = 42;\n    \n    bp::WriteLn(\"Hello, \", name, \"!\");\n    bp::WriteLn(\"Age: \", age);\n}\n\nint main() {\n    ProgramMain();\n    return 0;\n}\n```\n\n## 🔧 Advanced Usage\n\n### Using External C/C++ Libraries\n\nBlaise Pascal works seamlessly with external libraries thanks to the isolated `bp` namespace:\n\n```pascal\nprogram RaylibDemo;\n\n{$INCLUDE_HEADER '\u003craylib.h\u003e'}\n{$LIBRARY_PATH .\\lib}\n{$LINK libraylib.a}\n\nconst\n  SCREEN_WIDTH = 800;\n  SCREEN_HEIGHT = 450;\n\nbegin\n  InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, 'Blaise Pascal + raylib');\n  SetTargetFPS(60);\n  \n  while not WindowShouldClose() do\n  begin\n    BeginDrawing();\n    ClearBackground(RAYWHITE);\n    DrawText('Hello from Blaise Pascal!', 190, 200, 20, LIGHTGRAY);\n    EndDrawing();\n  end;\n  \n  CloseWindow();\nend.\n```\n\n### Build Configuration\n\nCreate a project-specific build configuration by using compiler directives:\n\n```pascal\nprogram MyGame;\n\n{$TARGET native}\n{$OPTIMIZATION ReleaseFast}\n{$APPTYPE GUI}\n\n{$INCLUDE_HEADER \u003craylib.h\u003e}\n{$LIBRARY_PATH .\\lib}\n{$LINK raylib.lib}\n\nbegin\n  // Your game code here\nend.\n```\n\n## 📖 Documentation\n\nFor comprehensive documentation, visit:\n- [Design Document](docs/DESIGN.md) - Complete architecture and design philosophy\n- [Language Coverage](docs/COVERAGE.md) - Detailed feature list\n- [Examples](examples/) - Sample projects\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n### Development\n\nThe project is structured as follows:\n- `src/compiler/` - Blaise Pascal compiler (Delphi source)\n- `bin/res/runtime/` - C++23 runtime library\n- `bin/res/zig/` - Bundled Zig compiler\n- `examples/` - Example projects\n- `docs/` - Documentation\n\n## 📄 License\n\nBlaise Pascal is licensed under the BSD 3-Clause License. See [LICENSE](LICENSE) for details.\n\n## 🌐 Links\n\n- **Website**: [tinyBigGAMES](https://tinybiggames.com)\n- **YouTube**: [youtube.com/tinyBigGAMES](https://youtube.com/tinyBigGAMES)\n- **Discord**: [discord.gg/tPWjMwK](https://discord.gg/tPWjMwK)\n- **GitHub**: [github.com/tinyBigGAMES/BlaisePascal](https://github.com/tinyBigGAMES/BlaisePascal)\n- **BlueSky**: [bsky.app/profile/tinybiggames.com](https://bsky.app/profile/tinybiggames.com)\n\n## 🙏 Acknowledgments\n\n- Built with ❤️ for the Pascal community\n- Uses [DelphiAST](https://github.com/RomanYankovsky/DelphiAST) for Pascal parsing\n- Powered by [Zig](https://ziglang.org/) and LLVM for C++ compilation\n\n---\n\n**Copyright © 2025-present tinyBigGAMES™ LLC. All Rights Reserved.**\n","funding_links":["https://github.com/sponsors/tinyBigGAMES"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybiggames%2Fblaisepascal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinybiggames%2Fblaisepascal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybiggames%2Fblaisepascal/lists"}