//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010, 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available
// under the terms of the MIT License which is available at
// https://opensource.org/licenses/MIT
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

include::_root_attributes.asciidoc[]

indexterm:[interpreter]

:leveloffset: -2

[[interpreter-chapter-index]]
== ToolDef interpreter

ToolDef scripts can be executed using the ToolDef interpreter, either on the command line, or in the ESCET IDE.

indexterm:[execution,command line]
indexterm:[command line,execution]

=== Command line

To execute a ToolDef script on the command line, use the `tooldef` executable.
To start executing a ToolDef script, enter something like this on the command line:

[source, shell]
----
tooldef some_script.tooldef
----

indexterm:[options,command line]
indexterm:[command line,options]
Additional options are available, to influence how the script is executed.
For details, execute the ToolDef interpreter with the `--help` or `-h` command line option:

[source, shell]
----
tooldef --help
----

In particular, consider the following options:

* _Tool invocation_ (`--invoke=INVOCATION` or `-i INVOCATION`)
+
The tool to invoke, and its arguments, in ToolDef syntax.
For example: `tooldef some_script.tooldef --invoke='mytool(1, true)'` to invoke the `mytool` tool with arguments `1` and `true`.
If the option is not used, the entire ToolDef script is executed instead.
By default, the entire script is executed.

indexterm:[execution,ESCET IDE]
indexterm:[ESCET IDE,execution]

=== ESCET IDE

indexterm:[options,ESCET IDE]
indexterm:[ESCET IDE,options]
To execute a ToolDef script in the ESCET IDE, right click the `.tooldef` or `.tooldefx` file or an open text editor for the script, and choose menu:Execute ToolDef[].
Alternatively, choose menu:Execute ToolDef...[] to first shown an option dialog.
The dialog shows several options that influence how the script is executed.
These options can be configured as desired before executing the script.

It is also possible to start executing a script by pressing kbd:[F10], while a `.tooldef` or `.tooldefx` file is selected or an open text editor for such a file has the focus.
Finally, clicking the corresponding toolbar icon (image:{imgsdir}/tooldef_icon.png[]) has the same effect.

Execution of ToolDef script can be manually terminated by means of the termination features of the _Applications_ view.
