How plutolang/pluto works
Project Type and Purpose
• Pluto is a compiler/runtime for a Lua-derived programming language (“dialect of Lua”) that offers new syntax, an enhanced standard library, and bytecode compatibility with Lua 5.4.
• It includes both an interpreter (pluto) and a ahead-of-time compiler (plutoc), plus build scripts and packaging workflows for multiple targets (native, DLL, WebAssembly, NuGet, Debian, etc.).
File-Structure Analysis
• Top-level:
• .github/workflows → CI pipelines (build, test, docker)
• scripts/ → PHP scripts orchestrating compilation, linking, bundling (DLL, static, NuPkg, DEB, WASM)
• src/ → core C++ source code, divided by modules: lexer, parser, VM, standard libraries, utilities
• Makefile + Pluto.sln / *.vcxproj → cross-platform build definitions (Unix Makefile, Windows solution/project)
• operadores.pluto, *.sun files → language specs/macros processed at build time
• testes/ → test suite (functional and benchmark scripts in Pluto/Lua)
• Key patterns:
• Compiler pipeline (lexer → parser → AST → bytecode generator)
• VM runtime (instruction dispatch loop, garbage collector, standard-library bindings)
• Modular standard libs (crypto, JSON, HTTP, canvas, etc.)
• Build-time code generation via “.sun” templates and scripts
README Insights
• Emphasizes compatibility with Lua 5.4, extended syntax, and binary bytecode compatibility.
• Points to website/docs for language features and playground.
Detailed & Essential Coverage
• Build orchestration (Makefile, scripts, CI)
• Language-feature preprocessing (.sun files)
• Parser → AST → Bytecode → VM path
• Standard library modules as pluggable units
• Dual execution modes (interpreter vs. AOT compiler)
• Avoid over-fragmentation; group closely related C++ modules (e.g., all l*lib.cpp files) into a “Standard Library” block, while still calling out major categories (crypto, JSON, IO, etc.).