funstx(1)

NAME
funstx - Fun syntax checker and fixer

SYNOPSIS
funstx [--fix] file1.fun [file2.fun ...]

DESCRIPTION
funstx parses one or more .fun source files to verify syntax without executing them. With --fix, it attempts conservative, idempotent edits to align files with parser expectations and then re-checks before writing changes.

OPTIONS

--fix
    Attempt safe automatic corrections before re-checking. Only writes a file if the fixed version parses successfully.

OUTPUT

On success
    Prints "path/to/file.fun: OK".

On failure
    Prints "path/to/file.fun:line:col: syntax error: <message>".

EXIT STATUS

0   All provided files parsed successfully.

1   At least one file failed to parse (after optional fixing).

2   Incorrect usage (e.g., no files provided).

AUTO-FIX RULES
The fixer applies a small set of conservative transformations:

•   Normalize line endings: CRLF/CR → LF.

•   Convert leading tabs to spaces; normalize indentation to multiples of two spaces.

•   Trim trailing spaces.

•   Ensure the file ends with a single newline.

•   Normalize type aliases: sint8|sint16|sint32|sint64 → int8|int16|int32|int64 (word-boundary aware).

Structural issues that require semantic changes are not auto-fixed; if parsing still fails, the original file is left unchanged and an error is reported.

EXAMPLES

Check a single file
      funstx examples/arrays.fun

Check and auto-fix a file
      funstx --fix examples/arrays.fun

Bulk check and auto-fix all examples
      find examples -type f -name '*.fun' -print0 | xargs -0 -n 50 funstx --fix

BUILD AND INSTALL
Built as CMake target funstx and installed alongside fun into /usr/bin by default.

SEE ALSO
fun(1)
Project documentation: docs/funstx.md

AUTHORS
The Fun project authors.

COPYRIGHT
© The Fun authors. Licensed under the project license; see the LICENSE file distributed with this source.