Architecture Guide¶
Overview¶
Ajasendiri is a C interpreter with four main layers:
Lexer: source text -> token stream
Parser: token stream -> AST
Runtime: executes AST and enforces runtime typing
CLI: entrypoints for run/check/test/fmt/repl/debug/mmk
Execution flow¶
Typical execution path:
src/cli/main.creads command and source.src/lexer/lexer.ctokenizes the source.src/parser/parser.cbuilds AST (via parser submodules).src/runtime/runtime.cexecutes using runtime submodules.Errors return to CLI with context.
Source map¶
Core headers¶
include/core/token.hinclude/core/ast.hinclude/core/api.hinclude/ajasendiri.h
Lexer¶
src/lexer/lexer.c
Parser¶
src/parser/parser.c(entrypoint)src/parser/base.c(shared parser utilities)src/parser/expr.c(expression grammar)src/parser/stmt.c(statement grammar)src/parser/decl.c(declarations, import/export)
Runtime composition wrappers¶
src/runtime/runtime.csrc/runtime/base.csrc/runtime/exec.csrc/runtime/builtins.c
Runtime core modules¶
src/runtime/base/core_types_and_values.csrc/runtime/base/containers_env_debug.csrc/runtime/base/runtime_core_and_modules.csrc/runtime/modules.csrc/runtime/typecheck.c
Runtime execution modules¶
src/runtime/exec/eval_expr.csrc/runtime/exec/exec_stmt_and_runtime.csrc/runtime/exec/public_api.c
Runtime builtins modules¶
src/runtime/builtins/value_cast_json.csrc/runtime/builtins/functions_kostroutine_math_time.csrc/runtime/builtins/native_json_fs_path_regex_http_parse.csrc/runtime/builtins/http_transport_and_rand.csrc/runtime/builtins/native_stdlib_calls.csrc/runtime/builtins/call_dispatch.c
CLI modules¶
src/cli/main/shared_utils_and_dep_parse.csrc/cli/main/project_io_and_registry.csrc/cli/main/repl_debug_format.csrc/cli/main/mmk_core_commands.csrc/cli/main/mmk_advanced_and_main.c
Where to put new code¶
New syntax/tokens: lexer + parser + core headers.
New runtime semantics:
src/runtime/execandsrc/runtime/base.New builtin/native module behavior:
src/runtime/builtinsandsrc/runtime/modules.c.New CLI/tooling behavior:
src/cli/main.
Contributor guidelines¶
Use descriptive filenames by responsibility.
Keep composition wrappers (
base.c,exec.c,builtins.c,main.c) focused on includes/wiring.Add or update tests in
tests/spec/passandtests/spec/fail.Update docs when behavior changes.
Builtin extension checklist¶
Register/export symbol in
src/runtime/modules.c.Implement behavior in the matching runtime builtin module.
Add pass/fail tests under
tests/spec.Update
docs/stdlib.rstandDEV.rst.