trextract 0.23.43

dotnet tool install --global trextract --version 0.23.43
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local trextract --version 0.23.43
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=trextract&version=0.23.43
                    
nuke :add-package trextract --version 0.23.43
                    

trextract

Summary

Extract all target-specific codes from Antlr4 grammar and write out macros and target-independent Antlr4 grammar with macros.

Description

Given parsed .g4 files, output a refactored grammar files that have all target-specific codes replaced with macro calls. The trexpand command performs the opposite transformation. The purpose of the code is to help convert target-agnostic and target-specific grammars into completely target independent grammars.

Usage

trparse *.g4 | trextract | trsponge -c

Details

Example

Consider the following grammar that is split.

Input to command

Command

trparse ExpressionLexer.g4 ExpressionParser.g4 | trextract | trsponge -c

The outputed files are:

Current version

0.23.43 Fixes to trgen templates.

License

The MIT License

Copyright (c) 2025 Ken Domino

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.23.43 97 3/28/2026
0.23.42 95 2/21/2026
0.23.41 96 1/25/2026
0.23.40 91 1/25/2026
0.23.39 93 1/22/2026
0.23.38 90 1/21/2026
0.23.37 95 1/20/2026
0.23.36 103 1/18/2026
0.23.35 102 1/16/2026
0.23.34 103 1/6/2026
0.23.33 99 12/28/2025
0.23.32 179 12/22/2025
0.23.31 267 12/19/2025
0.23.30 274 12/17/2025
0.23.29 279 12/17/2025
0.23.28 219 12/4/2025
0.23.27 213 10/30/2025
0.23.26 181 8/17/2025
0.23.25 177 8/9/2025
0.23.24 215 7/15/2025
Loading failed

# trextract
## Summary
Extract all target-specific codes from Antlr4 grammar and write
out macros and target-independent Antlr4 grammar with macros.
## Description
Given parsed .g4 files, output a refactored grammar files that
have all target-specific codes replaced with macro calls. The
trexpand command performs the opposite transformation. The purpose
of the code is to help convert target-agnostic and target-specific
grammars into completely target independent grammars.
## Usage
trparse *.g4 | trextract | trsponge -c
## Details
## Example
Consider the following grammar that is split.
_Input to command_
_Command_
trparse ExpressionLexer.g4 ExpressionParser.g4 | trextract | trsponge -c
The outputed files are:
## Current version
0.23.43 Fixes to trgen templates.
## License
The MIT License
Copyright (c) 2025 Ken Domino
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.