Skip to content
Topazdocs
6.05.21

Search documentation

Specification 6.0

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Download

    Tools

    6.0 command examples

    Invocations for the Topaz 6.0 development CLI. The examples follow the CLI source.

    Language mode
    6.0
    Product
    Not released

    Prepare the sample file

    For commands that take main.tpz, save the source from your first program under that name. Use a working copy of 5.21 source for migrate.

    Source files

    • topaz parse main.tpz --language-version 6.0. Check the syntax of the file. A clean parse prints main.tpz: parse-ok.
    • topaz dump-ast main.tpz --language-version 6.0. Print the parser’s syntax tree for the file.
    • topaz check main.tpz --language-version 6.0. Resolve imports and check types. A clean check in human format prints types-ok and resolve-ok. Add --format json for JSON diagnostics or --exports-json for export data on standard output.
    • topaz run main.tpz --language-version 6.0. Check the file, compile it to a temporary native executable and run it. This needs the installed code writer and local Rust build tools. Add --compiler rust for the reference interpreter. See Running programs.
    • topaz test diagnose-and-test.tpz --language-version 6.0 --compiler rust. Run the assertions in the diagnostic tour. A successful test prints diagnose-and-test.tpz: test-ok.
    • topaz fmt main.tpz --language-version 6.0 --check. Check formatting without writing the file. Differences lead to exit status 1.

    Packages and migration

    • topaz init --root my-package. Create a native package with topaz.toml and src/main.tpz. Choose a directory without an existing manifest or entry.
    • topaz add util --path ../util --root my-package. Declare a local dependency. Put a package named util beside my-package first. The dependency path is relative to the package root.
    • topaz lock --root my-package. Write topaz.lock for the package inputs. Registry content must already be available if its hash is needed.
    • topaz vendor --root my-package --from ./registry. Use an existing local registry directory to materialize declared registry dependencies and write the lock.
    • topaz doc --root my-package --out-dir api. Check the package’s export module and write exports.json and index.md in api.
    • topaz migrate main.tpz --from 5.21 --to 6.0. Preview edits on a working copy of 5.21 source. See the migration guide.

    Native development commands

    • topaz emit main.tpz --target rust. With native-dev and its installed writer, emit Rust to standard output. See native commands.
    • topaz build main.tpz --target native --out-dir out. With native-dev and local tools, build into a new directory. See native commands.

    Inspect the CLI

    • topaz explain TPZ5523. Read the explanation for a duplicate protocol bound and its suggested repair.
    • topaz version --verbose. Identify the compiler, language mode and engine.
    • topaz license. Print the installed license terms.
    • topaz notice. Print the installed notices.
    • topaz help. List commands and their options for this CLI.

    Commands with 5.21 examples

    These commands are unavailable in the 6.0 development CLI. Their examples on the command pages apply to Topaz 5.21.3.