How zoolah/cove works
Cove is a lightweight stack-based language: users provide source through the CLI or browser playground, the compiler turns it into bytecode, and the virtual machine executes it. The compiler covers expression parsing and statement compilation; VM instruction handlers implement arithmetic, control flow, I/O, variables, tables, and classes. Standalone executable generation is another documented CLI capability. The README documents the pipeline and language features; some implementation relationships below are based on excerpts, while unsampled details are left unconnected.
Main entry points: machine.hpp VM run loop · compiler.hpp Compile blocks · entry.cpp CLI entry · tokenizer.cpp Tokenizer
Components 21
Compiler
- Tokenizer
src/compiler/components/tokenizer.cpp - Compile blocks
src/compiler/compiler.hpp - Statement compilers
src/compiler/statements - Definitions
src/compiler/statements/definitions.cpp - Expression evaluator
src/compiler/components/evaluator.cpp - Bytecode printer
src/compiler/components/printer.cpp
Virtual machine
- VM run loop
src/vm/machine.hpp - Stack operations
src/vm/ops/stack.cpp - Arithmetic
src/vm/ops/arithmetic.cpp - Input and output
src/vm/ops/io.cpp - Variable scopes
src/vm/ops/vars.cpp - Control flow
src/vm/ops/cflow.cpp - Tables
src/vm/ops/tables.cpp - Classes
src/vm/ops/classes.cpp
User interfaces
- CLI entry
src/entry.cpp - Web playground
web/app.js - Standalone packaging
src/standalone/standalone.cpp - WebAssembly runtime
web/cove.wasm
Other components
- CLI user
- Playground user
- Tokens and bytecode
src/shared/structs.hpp
Connections 22
- CLI user → CLI entry: runs source
README.md - Playground user → Web playground: uses playground
README.md - CLI entry → Tokenizer: tokenizes source
README.md - Tokenizer → Compile blocks: supplies tokens
README.md - Compile blocks → Statement compilers: dispatches statements
README.md - Compile blocks → Expression evaluator: evaluates expressions
src/compiler/compiler.hpp - Statement compilers → Definitions: compiles definitions
README.md - Definitions → Expression evaluator: compiles expressions
src/compiler/statements/definitions.cpp - Compile blocks → Bytecode printer: prints bytecode
src/compiler/components/printer.cpp - Compile blocks → Tokens and bytecode: emits instructions
src/compiler/compiler.hpp - CLI entry → Compile blocks: compiles source
src/entry.cpp - CLI entry → VM run loop: runs bytecode
src/entry.cpp - VM run loop → Stack operations: dispatches opcodes
src/vm/machine.hpp - VM run loop → Arithmetic: dispatches opcodes
src/vm/machine.hpp - VM run loop → Input and output: dispatches opcodes
src/vm/machine.hpp - VM run loop → Variable scopes: dispatches opcodes
src/vm/machine.hpp - VM run loop → Control flow: dispatches opcodes
src/vm/machine.hpp - VM run loop → Tables: dispatches opcodes
src/vm/machine.hpp - VM run loop → Classes: dispatches opcodes
src/vm/machine.hpp - VM run loop → Tokens and bytecode: executes instructions
src/vm/machine.hpp - CLI entry → Standalone packaging: supports standalone mode
README.md - Web playground → WebAssembly runtime: uses runtime