Goiaba: An experimental Go compiler, written in Rust
11 hours ago
- #Rust
- #Go
- #WebAssembly
- Goiaba is an experimental Go parser and WebAssembly compiler written in Rust.
- It translates Go source code into WebAssembly bytecode for browser and other WASM environments.
- Key features include parsing Go into AST, compiling functions to WASM modules, and supporting fundamental Go language features.
- Exports Go functions for use in JavaScript, Rust (via C ABI), and Zig (via C ABI).
- Provides a command-line interface and programmatic API for Rust projects.
- Installation via `cargo install goiaba` and usage examples provided.
- Supports various Go constructs like functions, control flow, arithmetic, structs, arrays, and more.
- Exported functions use `//export` directive for WASM callability.
- Components include Parser, AST, Translator, Compiler, and CLI.
- Future improvements include optimizations like dead code elimination and constant folding.
- Current limitations: no garbage collection, limited standard library, no concurrency primitives.
- Licensed under BSD-3-Clause, copyright Raphael Amorim 2024.