/cli # CLI binary entrypoint (main.cpp)
/src
/Lexer # Tokenizer: Lexer.cpp, Operators.hpp/.cpp, Token.hpp
/Parser # Parser: Parser.hpp/.cpp, ParsedExpression.hpp
/Interpreter # AST nodes (ExpressionNode, StatementNode, OperationsFactory, etc.)
/Modules # Built‑in modules (Array, File, JSON, Print, String, VariableHelpers)
/Symbols # SymbolTable, SymbolContainer, Value, Types
/Modules # External/plugin modules (e.g., CurlModule)
test_scripts # Reference scripts (.vs) for tests/examples
build # Out‑of‑source build directory
CMakeLists.txt).cmake -S . -B buildcmake --build build (or ninja -C build).build/:build/voidscript (CLI)build/libvoidscript.sobuild/Modules/<ModuleName>Located in src/Modules/BuiltIn/. They export C++ functions to the interpreter via BuiltinModule interface.
Under /Modules/<YourModule>/:
1. Create CMakeLists.txt next to PluginInit.cpp.
2. Implement hook VS_MODULE_INIT() to register functions.
3. Build installs to build/Modules/<YourModule>.
src/Lexer/Lexer.hpp/.cpp, Operators.hpp/.cpp, Token.hpp.Operators.hpp defines token categories (arithmetic, logical, relational, assignment, punctuation).Lexer::matchOperatorOrPunctuation, longest‑match two‑char operators first.Operators.cpp.matchIdentifierOrKeyword or matchNumber.src/Parser/Parser.hpp/.cpp.Parser::parseScript(), which loops parseStatement() until EOF.parseVariableDefinition(), parseAssignmentStatement(), parseIfStatement(), parseWhileStatement(), parseForStatement(), parseCallStatement(), parseReturnStatement().parseStatementNode(), plus parseIfStatementNode(), parseForStatementNode().parseParsedExpression() implements a shunting‑yard algorithm; outputs ParsedExpression AST fragments.src/Interpreter/:ExpressionNode (evaluate returns Symbols::Value)StatementNode (interpret for side‑effects)ParsedExpression to concrete ExpressionNode in Parser/ExpressionBuilder.hpp.evaluate() or interpret().Interpreter/.ExpressionBuilder (for expr nodes) or parser (for stmt nodes).Interpreter/OperationsFactory.hpp/.cpp: factories to record operations (Assignment, Call, Conditional, Loop, Return).Operations::Container holds a list of operations per scope; executed by Interpreter.OperationsFactory to enqueue AST StatementNode into the container.Operators.hpp and adjust Lexer.cpp matching logic.Parser::keywords (if needed).parseXxx() or extend parseStatementNode()/parseParsedExpression().ExpressionNode or StatementNode subclass with semantics.evaluate() or interpret() in the node..vs script under test_scripts/ and run with debug flags.test_scripts/.voidscript --debug=lexer script.vsvoidscript --debug=parser script.vsvoidscript --debug=interpreter script.vsprintnl(...) functions in scripts to observe runtime behavior.---
This document must be updated whenever changes are made to the codebase (lexer, parser, AST nodes, modules, build system, etc.) to keep the guide current.
Generated by Codex CLI Agent
Always keep this file in sync with project changes.