How migu3873378373737/ng works
NG is a C11 language runtime and CLI. Its main workflow reads a .ng program, prepares an AST through the Dynamic V preparation path, then executes it with the native interpreter; the CLI also offers syntax checking, compilation to cache, and an interactive REPL. The README documents additional capabilities including package management, JSON/SQLite, formatting and diagnostics, HTTP, and language interoperability. Edges reflect the shown CLI calls, indexed source references, or explicit README statements; several library-internal connections remain unshown.
Main entry points: main.c NG CLI · ng_dynamicv.c Dynamic V Preparation · interpreter.c Interpreter · ng_native_module.c Native Module Registry
Components 22
Execution Runtime
- Interpreter
src/interpreter.c - Values and Scopes
src/value.c - Runtime Tables
src/runtime.c - Native Module Registry
src/ng_native_module.c
Dynamic V
- Dynamic V Preparation
src/ng_dynamicv.c - Intermediate IR
src/ng_ir.c - Lua Optimizer
src/ng_lua_optimizer.c - N3 AST Cache
src/ng_n3cache.c
Native Capabilities
- JSON Module
src/ng_json.c - SQLite Module
src/ng_sqlite.c - Formatting and Print
src/ng_print.c - HTTP Server
src/ng_http.c - HTTP Client
src/ng_http_client.c - Language Interop
src/ng_interop.c - Network and Lua Backend
src/ng_net_libs.c
CLI and Integrations
- NG CLI
src/main.c - Interactive REPL
src/repl.c - Package Manager
src/ng_dependency.c
Other components
- Programmer
Connections 26
- Programmer → NG CLI: runs commands
- NG CLI → Interactive REPL: starts REPL
src/main.c - NG CLI → Package Manager: dispatches package commands
src/main.c - NG CLI → Dynamic V Preparation: prepares program
src/main.c - NG CLI → Interpreter: runs AST
src/main.c - NG CLI → Native Module Registry: initializes modules
src/main.c - Dynamic V Preparation → Lexer: uses lexer
src/ng_dynamicv.c - Dynamic V Preparation → Parser: uses parser
src/ng_dynamicv.c - Dynamic V Preparation → N3 AST Cache: loads or stores AST
src/ng_dynamicv.c - Dynamic V Preparation → Intermediate IR: uses IR
src/ng_dynamicv.c - Dynamic V Preparation → Lua Optimizer: uses optimizer
src/ng_dynamicv.c - Parser → Lexer: consumes tokens
src/parser.c - Parser → AST: builds AST
src/parser.c - Interpreter → Runtime Tables: uses scopes
src/interpreter.c - Interpreter → Values and Scopes: evaluates values
src/interpreter.c - Interpreter → Native Module Registry: resolves modules
src/interpreter.c - Programmer → JSON Module: uses JSON module
- Programmer → SQLite Module: uses SQLite module
- Programmer → Formatting and Print: uses formatting
- Programmer → HTTP Server: uses HTTP
- Programmer → HTTP Client: uses HTTP client
- Programmer → Language Interop: uses interop module
- NG CLI → Network and Lua Backend: selects Lua backend
src/main.c - Package Manager → HTTP Client: downloads packages
src/ng_dependency.c - Native Module Registry → JSON Module: registers capabilities
- Native Module Registry → SQLite Module: registers capabilities