Initial Commit

Working base grammar, visitor, client, context.
Good test coverage for grammar constructs.
This commit is contained in:
2026-05-30 04:57:04 +10:00
commit 19da69b3e8
11 changed files with 917 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from .terms import ExecutorTerm
class ExecContext:
"""
Base context class that carries the instantiation state.
This is passed to all CommandTerms upon execution.
"""
def __init__(self, *, alias: str, args: list[str], content: str, **kwargs):
self.alias = alias
self.args = args
self.content = content
# Dictionary of local variables for the command context.
# Useful if the Terms need to share state
self.scope: dict[str, Any] = {}
# Stack of terms that are *currently* executing with this context.
self.termstack: list['ExecutorTerm'] = []