Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ast command

The ast command parses a Ralix source file and prints its Abstract Syntax Tree (AST) in JSON format.

Usage

ralix ast [OPTIONS] <SOURCE_FILE>

Arguments

  • <SOURCE_FILE>: The path to the source file to parse.

Options

  • -o, --output <FILE>: The file to write the AST to. If not provided, the AST is printed to the console.

Description

The ast command is a useful tool for developers who want to inspect the structure of their code. It takes a source file, parses it, and then serializes the resulting AST into a pretty-printed JSON string.

Examples

To print the AST of a file named main.ralix to the console:

ralix ast main.ralix

To save the AST to a file named ast.json:

ralix ast -o ast.json main.ralix