Jac Language Command Line Interface (CLI)#
Jac Language CLI is with a variety of commands to facilitate users. Additionally, Jac language offers users the ability to define custom CLI commands through plugins. This document aims to provide an overview of each command along with clear usage instructions. Jac CLI can ba accessed using bash commands as well as by bashing jac
which will start the Jac CLI.
jac tool
#
Jac Language offers language tools to perform various tasks efficiently. The tool
command is utilized to execute specific language tools along with any optional arguments as needed. This command enables users to interact with language-specific command line tools designed to manage the language effectively.
jac_tool
: The name of the language tool to execute.
- ir
, pass_template
, py_ast_nodes
, md_doc
, automate_ref
are the jac_tools used to handle (Usage instruction is below)
- args
: Optional arguments for the specific language tool.
1.1. jac_tool
ir
:ir
tool generates an Abstract Syntax Tree (AST) and SymbolTable tree for a .jac file, or a Python AST for a .py file.ir
tool is used withtool
cli command.
Parameters for jac tool ir
output_type
: Choose one of the following options:sym
: Provides the symbol table of the specified .jac file.sym.
: Generates a dot graph representation of the symbol table for the specified .jac file.ast
: Displays the Abstract Syntax Tree (AST) of the specified .jac file.ast.
: Generates a dot graph representation of the AST for the specified .jac file.pyast
: Generates the Python AST for a .py file or the relevant Python AST for the generated Python code from a .jac file.py
: Displays the relevant generated Python code for the respective Jac code in a .jac file.-
file_path
: Path to the .jac or .py file. -
To get the symbol table tree of a Jac file:
- To generate a dot graph of the symbol table tree for a Jac file:
- To view the AST tree of a Jac file:
jac_tool
pass_template
:pass_template
tool generates pass template for jac.jac_tool
py_ast_nodes
:py_ast_nodes
tool lists python ast nodes.jac_tool
md_doc
:md_doc
tool generate mermaid markdown doc.jac_tool
automate_ref
:automate_ref
tool automates the reference guide generation.
jac run
#
The run
command is utilized to run the specified .jac or .jir file.
file_path
: Path of .jac or .jir file to run.
- main
: (Optional, bool) A flag indicating whether the module being executed is the main module. Defaults to True
- cache
:The cache flag to cache
- To run file_path Jac file:
jac clean
#
The clean
command is utilized to remove the jac_gen , pycache folders from the current directory recursively.
jac format
#
The format
command is utilized to run the specified .jac file or format all .jac files in a given directory.
file_path/directory_path
: The path to the .jac file or directory containing .jac files.
- outfile
: (Optional) The output file path (only applies when formatting a single file).
- debug
:(Optional) If True, print debug information. Defaults to False
To format all .jac files from walking through current located directory:
jac check
#
The check
command is utilized to run type checker for a specified .jac file.
file_path
: Path of .jac file to run type checker.
jac build
#
The build
command is utilized to build the specified .jac file.
file_path
: Path of .jac file to build.
jac enter
#
The enter
command is utilized to run the specified entrypoint function in the given .jac file.
file_path
: The path to the .jac file.
- entrypoint
: The name of the entrypoint function.
- args
: Arguments to pass to the entrypoint function.
- To enter file_path Jac file
jac test
#
The test
command is utilized to run the test suite in the specified .jac file.
file_path
: The path to the .jac file.