A lightning-fast, multi-language Abstract Syntax Tree (AST) generator and syntax highlighter. Architected with a high-performance C core engine powered by PCRE2 and JSON-C, textparser provides native, zero-overhead bindings and ports for Rust, Python, Java, and WebAssembly (WASM).
It serves as a robust foundation for building linters, static analysis tools, compilers, and terminal utilities like the built-in ccat clone.
- 🌐 Massive Language Support: Built-in regex-based grammars for modern and classic languages.
- ⚡ High Performance: Core tokenization and AST construction written in highly optimized C.
- 🧬 Multi-Language Ecosystem: Native language ports (Rust, Python, Java) manage underlying C memory safely.
- 🌐 WebAssembly Ready: Compile to WASM for client-side code analysis directly in the browser.
- 🎨 Built-in
ccatUtility: A colorized alternative to the standardcatcommand for terminal code viewing.
textparser features rich tokenization and syntax parsing rules for:
- System & General: C, C++, C#, Java, Go, Rust, Swift, Zig, C3, V, Ada, Assembly (x86/ARM)
- Web & Data: HTML, CSS, JavaScript, TypeScript, JSON, XML, SQL, Markdown
- Scripting: Python, PHP, Bash/Shell
yay -S textparser
# Or build from the latest git commit
yay -S textparser-gitsudo add-apt-repository ppa:bbarbulovski-gmail/textparser
sudo apt-get update
sudo apt-get install textparserPull and run the pre-configured container instantly:
docker pull bokic78/textparser
docker run --rm -v \$(pwd):/workspace bokic78/textparser --file /workspace/main.cEnsure you have cmake, ninja (optional but recommended), libpcre2, and libjson-c installed on your system.
git clone https://github.com
cd textparser
mkdir build && cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
ninja
sudo ninja installGenerate a clean, structured JSON representation of a source file's AST:
textparser --lang c --file main.c --format jsonView your code with automatic, high-performance syntax highlighting in the terminal:
textparser --ccat main.rsContributions are what make the open-source community an amazing place to learn, inspire, and create.
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
This project is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0) - see the LICENSE file for details.
Developed with ❤️ by Boris Barbulovski (bokic).