Commit aa00c122 authored by Roman Alifanov's avatar Roman Alifanov

Remove compiler architecture section from LANGUAGE_SPEC.md

Update bootstrap/ → compiler/ in install paths.
parent aeb3ef28
......@@ -1402,7 +1402,7 @@ sudo meson install -C builddir
Устанавливается:
- `/usr/bin/content` — CLI
- `/usr/share/content/bootstrap/` — компилятор
- `/usr/share/content/compiler/` — компилятор
- `/usr/share/content/lib/cli.ct` — стандартная библиотека
- `/usr/share/content/lib/cli.sh` — прекомпилированная CLI-библиотека
......@@ -1588,76 +1588,3 @@ Error: Unknown method 'badMethod' for type 'fs'. Available: append, exists, list
---
## Архитектура компилятора
```
┌─────────────────┐
│ Source .ct │
└────────┬────────┘
┌────────▼────────┐
│ Lexer │
│ (lexer.py) │
└────────┬────────┘
┌────────▼────────┐
│ Parser │
│ (parser.py) │
└────────┬────────┘
┌────────▼────────┐
│ DCE │
│ (dce.py) │
└────────┬────────┘
┌────────▼────────┐
│ Code Gen │
│ (Bash / AWK) │
└────────┬────────┘
┌────────▼────────┐
│ Output .sh │
└─────────────────┘
```
### Структура codegen (миксины)
```
CodeGenerator
├── ExprMixin # expr_codegen.py — выражения
├── StmtMixin # stmt_codegen.py — statements
├── ClassMixin # class_codegen.py — классы/методы
├── DecoratorMixin # decorator_codegen.py — декораторы
├── DispatchMixin # dispatch_codegen.py — диспатч, присваивания
├── CseMixin # cse_codegen.py — CSE оптимизации
├── StdlibMixin # stdlib.py — встроенные функции
└── AwkCodegenMixin # awk_codegen.py — @awk компиляция
Вспомогательные модули:
├── constants.py # Константы (RET_VAR, TMP_PREFIX, CLASS_FUNC_PREFIX, etc.)
└── methods/ # Единый реестр методов (bash_impl + awk_gen)
├── base.py # Method dataclass
├── string.py # StringMethods
├── array.py # ArrayMethods
├── dict.py # DictMethods
└── ... # http, fs, json, logger, math, time, etc.
```
### Добавление новых методов
Для добавления нового метода достаточно обновить соответствующий файл в `methods/`:
```python
# methods/string.py
class StringMethods:
...
new_method = Method(
name="new_method",
bash_func="__ct_str_new_method",
bash_impl='__CT_RET="${1}..."; echo "$__CT_RET"',
awk_gen=lambda obj, args: f"awk_impl({obj}, {args[0]})",
min_args=1, max_args=1,
)
```
Bash и AWK codegen автоматически подхватят изменения.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment