@@ -60,13 +60,86 @@ HRW4U aims to improve the following:
6060Standalone Compiler
6161-------------------
6262
63- A standalone Python compiler is available in ``tools/hrw4u `` for development:
63+ A standalone Python compiler is available in ``tools/hrw4u `` for development,
64+ testing, and migration workflows. It provides additional features not available
65+ in the native C++ parser:
6466
6567- Debug tracing (``--debug ``)
6668- IDE integration via LSP (``hrw4u-lsp ``)
6769- Reverse conversion (``u4wrh ``) to convert header_rewrite to hrw4u
6870
69- Build with Python 3.10+ using ``./bootstrap.sh && make package ``.
71+ Building the Standalone Compiler
72+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73+
74+ Build with Python 3.10+ using the bootstrap script:
75+
76+ .. code-block :: none
77+
78+ cd tools/hrw4u
79+ ./bootstrap.sh
80+ make package
81+
82+ This produces a PIP package in the ``dist `` directory. Install with:
83+
84+ .. code-block :: none
85+
86+ pipx install dist/hrw4u-1.4.0-py3-none-any.whl
87+
88+ Basic Usage
89+ ^^^^^^^^^^^
90+
91+ Compile a single file to stdout:
92+
93+ .. code-block :: none
94+
95+ hrw4u some_file.hrw4u
96+
97+ Compile from stdin:
98+
99+ .. code-block :: none
100+
101+ cat some_file.hrw4u | hrw4u
102+
103+ Compile multiple files to stdout (separated by ``# --- ``):
104+
105+ .. code-block :: none
106+
107+ hrw4u file1.hrw4u file2.hrw4u file3.hrw4u
108+
109+ Bulk Compilation
110+ ^^^^^^^^^^^^^^^^
111+
112+ For bulk compilation, use the ``input:output `` format to compile multiple files
113+ to their respective output files in a single command:
114+
115+ .. code-block :: none
116+
117+ hrw4u file1.hrw4u:file1.conf file2.hrw4u:file2.conf file3.hrw4u:file3.conf
118+
119+ This is particularly useful for build systems or when processing many configuration
120+ files at once. All files are processed in a single invocation, improving performance
121+ for large batches of files.
122+
123+ Reverse Tool (u4wrh)
124+ ^^^^^^^^^^^^^^^^^^^^
125+
126+ The reverse tool converts existing ``header_rewrite `` configurations to ``hrw4u ``.
127+ It supports the same usage patterns:
128+
129+ .. code-block :: none
130+
131+ # Convert single file to stdout
132+ u4wrh existing_config.conf
133+
134+ # Bulk conversion
135+ u4wrh file1.conf:file1.hrw4u file2.conf:file2.hrw4u
136+
137+ IDE Support
138+ ^^^^^^^^^^^
139+
140+ For IDE integration, the package provides an LSP server named ``hrw4u-lsp ``.
141+ This enables syntax highlighting, error diagnostics, and auto-completion in
142+ editors that support the Language Server Protocol.
70143
71144Syntax Differences
72145==================
@@ -401,8 +474,19 @@ These can be used with both sets and equality checks, using the ``with`` keyword
401474 Debugging
402475=========
403476
404- Syntax errors are reported with filename, line, and column position. For development,
405- the standalone compiler's ``--debug all `` option traces lexer, parser, and evaluation.
477+ Syntax errors are reported with filename, line, and column position. The native
478+ parser in ``header_rewrite `` provides clear error messages when parsing fails.
479+
480+ For development and debugging complex rules, use the standalone Python compiler
481+ with ``--debug `` to trace:
482+
483+ - Lexer and parser behavior
484+ - Condition evaluations
485+ - State and output emission
486+
487+ .. code-block :: none
488+
489+ hrw4u --debug /path/to/rules.hrw4u
406490
407491 Examples
408492========
0 commit comments