Перейти к содержимому
Топаз6.0 · До релиза
Загрузка →

Поиск в документации

Спецификация 6.0

Выберите результат стрелками и нажмите Enter, чтобы открыть его.

Введите имя API, номер диагностики, правило или тему проекта.

    Инструменты

    dump-ast

    Parses a source file and prints its abstract syntax tree.

    Invocation, options and results

    Ссылка

    topaz dump-ast

    Форма вызова
    1. topaz dump-ast <file>

    Ввод

    Supply exactly one readable UTF-8 file within the source size limit. The command accepts the listed compiler, verbosity, language, and resource options.

    The same argument and source rejection rules as parse apply. Package options and --format json are rejected.

    Параметры и конфликты

    ПараметрЗначение по умолчаниюКонтрактКонфликты
    --compiler rust|selfself

    compiler selector (default self); rust selects the reference compiler Also rejects combination with --producer, --self-source.

    Не перечислены
    --verbosefalse

    Reports the selected compiler and whether it was explicit or the default. For version, prints the detailed release report.

    Не перечислены
    --language-version <5.21>5.21

    language version selector

    Не перечислены
    --compiler-memory-mib <MiB>8192

    self compiler worker memory budget (8192); overrides TOPAZ_COMPILER_MEMORY_MIB A positive integer is required. Environment input: TOPAZ_COMPILER_MEMORY_MIB.

    Не перечислены
    --compiler-time-ms <ms>1800000

    self compilation wall-clock budget (1800000); overrides TOPAZ_COMPILER_TIME_MS A positive integer is required. Environment input: TOPAZ_COMPILER_TIME_MS.

    Не перечислены

    Каналы вывода

    stdout

    stderr

    Статус завершения

    0

    The source parses successfully.

    1

    Argument validation, source loading, parsing, or compiler execution fails.

    Эффекты

    The command reads the source and installed compiler resources without modifying project files. Compiler-owned temporary workspace files may be created and removed.

    No network access occurs and no dependency is fetched.

    The same input bytes, path, language mode, compiler build, and presentation settings produce the same tree and verdict. Dumps from different compiler builds are not required to be byte-identical.

    The syntax tree describes the supplied file. Imports are represented as syntax and are not fetched or resolved. No manifest or lock is written.

    Operation

    Ссылка

    Use the tree to inspect how the parser represents a source construct. Tree formatting is an inspection output.

    Option conditions

    Ссылка

    --compiler cannot be combined with bootstrap --producer or --self-source

    Behavior contract

    Ссылка
    Правилоtools-commands-dump-ast.rule.behavior

    Command behavior

    Arguments and rejection

    Supply exactly one readable UTF-8 file within the source size limit. The command accepts the listed compiler, verbosity, language, and resource options.

    The same argument and source rejection rules as parse apply. Package options and --format json are rejected.

    Output

    Standard output contains the selected parser's indented syntax tree. It has no success banner. Standard error carries parser diagnostics and any failure count.

    The tree dump is a human inspection representation. Field layout and node spelling can change with the compiler release and are not a JSON interchange schema. A recovered tree can accompany a failing parse, so callers must check the exit status.

    Exit status

    Exit 0 means the parser accepted the file. Exit 1 covers invalid arguments, input loading, syntax diagnostics, unsupported compiler selection, and worker or budget failure.

    Filesystem effects

    The command reads the source and installed compiler resources without modifying project files. Compiler-owned temporary workspace files may be created and removed.

    Network access

    No network access occurs and no dependency is fetched.

    Reproducibility

    The same input bytes, path, language mode, compiler build, and presentation settings produce the same tree and verdict. Dumps from different compiler builds are not required to be byte-identical.

    Packages and locks

    The syntax tree describes the supplied file. Imports are represented as syntax and are not fetched or resolved. No manifest or lock is written.

    Причина

    Tree inspection and syntax validation have different requested outputs. Keeping both commands preserves those distinct intentions even though they share the parser.

    The linked public CLI recipe checks one valid generic declaration, exit 0, and empty standard error. It does not assert the tree layout.

    The safe recipe covers a successful parse and checks the exit code. Recovered trees, syntax failures, and the inspection layout are outside its assertions.

    Example contract

    Ссылка
    Правилоtools-commands-dump-ast.rule.invocation

    Example contract

    The invocation topaz dump-ast main.tpz --language-version 5.21 is expected to exit with 0.

    The current SELF parser accepts the complete generic declaration and prints its AST. This test does not assert an AST serialization schema.

    Причина

    AST inspection uses the same parser as parse. Accepting the same declaration keeps the inspected tree consistent with syntax acceptance.

    Example

    Ссылка

    Small source invocation

    Ссылка
    main.tpzSmall source invocationОткрыть песочницу →
    1. function identity<T>(value: T) -> T {
    2. value
    3. }
    Ожидаемый выводКод завершения 0
    $ topaz dump-ast main.tpz --language-version 5.21 · Целевой продукт 5.21.3
    Ожидаемый результат

    Ожидаемый результат

    Синтаксический анализ принимает программу. Код завершения 0.

    The current SELF parser accepts the complete generic declaration and prints its AST. This test does not assert an AST serialization schema.

    Verification scope

    Ссылка

    Observed with Topaz 5.21.3 on 2026-11-06T08:36:29.642Z. This invocation passed; exit 0. 2 assertions were evaluated against the independent expected result. Execution record. This result covers the displayed invocation. That record uses the earlier fixture revision. The current recipe has not been run.

    Related references

    Ссылка

    Compiler selection →

    Packages, locks and targets →

    Меню

    Загрузка →