How zvnoob/another works
Main Components
• Main Entrypoint: File “main.cpp” is the execution starting point which likely initializes the interpreter.
• Lexical Analyzer (Tokenizer): Files like “token.hpp” and “tokenizer.hpp” indicate that there is a dedicated module for breaking the source code into tokens.
• Parser: “parser.hpp” is used to construct the Abstract Syntax Tree (AST) or some intermediate representation from tokens.
• Execution Engine: “executer.hpp” handles the evaluation or runtime processing of the parsed structures. This module likely traverses the AST or the compiled intermediate representation.
• Object System: “object.hpp”, “object_function.hpp”, and “object_operator.hpp” show that the language uses an object model to represent variables, functions, and operators.
• Core Library / Runtime Support: The “corelib_*” header files (core, env, io, thread, type) suggest a runtime/core library that implements the built-in functions and environment support (e.g., the “shared” scope detailed in the README).
• Utility/Support Modules: Files such as “str.hpp”, “type.hpp”, and “error.hpp” aid in string operations, type management, and error handling respectively.
• Build/Config: “compile_commands.json” and “.gitignore” are not part of the runtime but help with development.
Relationships and Interactions
• Input source code is fed into the Tokenizer, where it is segmented into tokens.
• The Parser consumes these tokens to generate a structured representation (likely an AST).
• The Execution Engine takes this representation and evaluates it, calling functions, and managing scopes.
• The Core Library components (corelib_*) provide pre-defined functions (like if, while, try, throw, etc.) and are accessible in the shared “@” scope.
• The Object System is intertwined with the Execution Engine, representing variables, functions, and operators during execution.
• Utility modules (error handling, string manipulation, type conversions) are used throughout the system to facilitate robust processing.
Architectural Patterns and Design Principles
• The project uses a layered design: starting from input processing (tokenizing/parsing), constructing an intervening structured representation, and then executing the program.
• A clear separation between syntax analysis (lexer/parser) and execution/interpretation (executer and object handling) is reflected.
• Core functions built into “shared” scope exemplify a runtime environment design where built-in functionalities are embedded into the interpreter’s environment.
b. In the center, place an “AST/Intermediate Representation” block.
g. Module relationships, such as dependency and control flows, are clearly visually indicated.