How janet-lang/janet works
Janet is an embeddable scripting language with a separate shell client for running scripts and providing a REPL. Its principal workflow is a user submitting source through the client, which the runtime parses, compiles, and executes; the README also describes embedding the core in C/C++ programs. The graph preserves documented language, concurrency, I/O, FFI, and debugging capabilities. Some internal stage links are dashed because the supplied excerpts do not show those call sites.
Main entry points: corelib.c Core library · shell.c Shell and REPL · compile.c Compiler · vm.c Virtual machine
Components 21
Client
- Shell and REPL
src/mainclient/shell.c - Embedding API
src/include/janet.h
Language processing
- Parser
src/core/parse.c - PEG engine
src/core/peg.c - Compiler
src/core/compile.c - Macros and specials
src/core/specials.c - Bytecode emitter
src/core/emit.c - Register allocator
src/core/regalloc.c
Execution runtime
- Bytecode
src/core/bytecode.c - Virtual machine
src/core/vm.c - Fibers
src/core/fiber.c - Event loop
src/core/ev.c - Garbage collector
src/core/gc.c
Core capabilities
- Core library
src/core/corelib.c - I/O and processes
src/core/io.c - Networking
src/core/net.c - Operating system
src/core/os.c - C FFI
src/core/ffi.c - Debugger
src/core/debug.c - Serialization
src/core/marsh.c
Other components
- Script user
Connections 17
- Script user → Shell and REPL: submits script
- Shell and REPL → Parser: runs source
- Parser → Compiler: produces syntax
- Compiler → Bytecode emitter: emits bytecode
src/core/compile.c - Compiler → Register allocator: allocates registers
src/core/compile.c - Bytecode emitter → Bytecode: produces instructions
- Bytecode → Virtual machine: executes
- Virtual machine → Fibers: runs fibers
- Virtual machine → Garbage collector: uses memory manager
src/core/vm.c - Script user → Embedding API: embeds runtime
- Core library → Event loop: offers event APIs
- Core library → I/O and processes: offers I/O APIs
- Core library → Networking: offers socket APIs
- Core library → Operating system: offers system APIs
- Core library → C FFI: offers FFI
- Core library → PEG engine: offers PEG
- Shell and REPL → Debugger: supports debugging