How simulanics/crossbasic works
Project Type and Purpose
• This is a cross-platform compiler/VM toolchain (CrossBasic) plus a companion native compiler (xcompile), a web-based IDE, a rich plugin system, language-interop templates, and Xojo integration.
• It compiles Xojo-style scripts into bytecode for a custom VM, or into native executables via a separate tool, and supports dynamic plugins written in C++, Rust, Go, etc., using libffi.
High-Level Component Breakdown
A. Core CLI Tools
• crossbasic (cross-platform bytecode compiler + VM)
• xcompile (native code compiler)
• build scripts: build_crossbasic.bat/.sh, build_xcompile.bat/.sh
• Dependencies: libffi (FFI), libcurl (HTTP)
B. Plugin Subsystem (Microkernel Extensions)
• Plugins/… directories: each plugin has source + build scripts
• Interoperability/Plugin Language Templates: C#, C++, C, Go, Rust templates
• Runtime loader in crossbasic that scans “libs” folder via libffi
C. IDE Subsystem (MVC-style Web App)
• Server (CrossBasic-IDE/server.cpp)
• Build scripts: CrossBasic-IDE/build-64.bat/.sh
• Performance tests under ServerPerformanceTest
D. Xojo Integration
• Xojo Integration/…: connector code (.xojo_code, .xojo_project)
• Embeds CrossBasic as a library into Xojo projects
E. Support Scripts & Tests
• Scripts/*.xs: code-generator scripts for plugin bindings & tests
• runallscripts.bat/.sh to run integration tests
Relationships & Data Flows
• Developer writes CrossBasic code in IDE (Browser ←→ IDE Server over HTTP).
• IDE Server invokes crossbasic CLI or embeds its library to compile/execute scripts.
• crossbasic VM loads plugins at runtime from “libs” via libffi.
• Plugins implement features (JSON, DateTime, LLMConnection, GUI, etc.) and may call external APIs via libcurl.
• For native targets, crossbasic can hand off to xcompile or developer uses xcompile CLI directly.
• Build scripts orchestrate compiling core tools and each plugin in their own subfolder.
• Xojo projects use generated connector code to call CrossBasic engine as a library.
Architectural Patterns & Principles
• Microkernel/Plugin architecture: minimal core VM and extensible feature set via plugins
• MVC for the IDE: server component (controller & model) + static web UI (view)
• CLI-driven build/deploy pipeline (scripts automate building core and plugin artifacts)
• Language interoperability via libffi (decouples plugin language from core)
Final Recommendations
• Be exhaustive: capture core engine, compiler, plugin framework, IDE layers, build automation, interop, and external services.
• A high-level view and, if helpful, a zoomed-in section (e.g., plugin loading sequence).