How yassinebenaid/bunster works
Bunster compiles shell scripts into standalone Go-based binaries. The main workflow is CLI build → module preparation and source parsing → static analysis → Go generation → Go toolchain output; generated programs use Bunster’s runtime rather than an external shell. The parser is split across lexical, syntax, and AST stages, while runtime capabilities include flags, environment files, and embedded assets. Module/package resolution is also a documented product capability. Relationships involving unsampled implementation details are omitted or marked unverified.
Main entry points: builder.go Build orchestration · shell.go Shell runtime · main.go Bunster CLI · parser.go Shell parser
Components 16
Shell frontend
- Lexer
lexer/lexer.go - Shell parser
parser/parser.go - Shell AST
ast/statement.go - Static analyser
analyser/analyser.go
Compilation
- Bunster CLI
cmd/bunster/main.go - Build orchestration
builder/builder.go - Go generator
generator/generator.go - Go instruction IR
ir/ir.go
Modules
- Module resolution
builder/mod.go
Generated runtime
- Shell runtime
runtime/shell.go - Flag parsing
runtime/flag.go - Environment loading
runtime/builtin/loadenv.go - Embedded assets
runtime/builtin/embed.go
Other components
- Script author
- Go toolchain
- Compiled binary
Connections 19
- Script author → Bunster CLI: invokes
cmd/bunster/main.go - Bunster CLI → Build orchestration: builds via
cmd/bunster/main.go - Bunster CLI → Lexer: creates lexer
cmd/bunster/main.go - Bunster CLI → Shell parser: parses for AST
cmd/bunster/main.go - Lexer → Shell parser: supplies tokens
parser/parser.go - Shell parser → Shell AST: produces
parser/parser.go - Build orchestration → Shell parser: parses sources
builder/builder.go - Build orchestration → Static analyser: checks scripts
builder/builder.go - Build orchestration → Module resolution: resolves modules
- Static analyser → Shell AST: validates
analyser/analyser.go - Build orchestration → Go generator: generates Go
- Go generator → Go instruction IR: creates instructions
generator/generator.go - Go instruction IR → Shell runtime: emits runtime calls
ir/ir.go - Build orchestration → Go toolchain: compiles generated code
- Go toolchain → Compiled binary: produces
- Compiled binary → Shell runtime: runs with
- Shell runtime → Flag parsing: uses flag parser
- Shell runtime → Environment loading: supports env files
- Shell runtime → Embedded assets: supports embedded assets