Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/whitequark/python-itanium_demangler
Pure Python Itanium C++ ABI demangler
https://github.com/whitequark/python-itanium_demangler
Last synced: 15 days ago
JSON representation
Pure Python Itanium C++ ABI demangler
- Host: GitHub
- URL: https://github.com/whitequark/python-itanium_demangler
- Owner: whitequark
- License: 0bsd
- Created: 2018-10-09T19:43:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-20T14:32:24.000Z (about 2 years ago)
- Last Synced: 2024-10-13T01:45:33.912Z (30 days ago)
- Language: Python
- Size: 18.6 KB
- Stars: 34
- Watchers: 8
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-0BSD.txt
Awesome Lists containing this project
- stars - whitequark/python-itanium_demangler
README
# Itanium Demangler
The *Python Itanium Demangler* is a pure Python parser for the [Itanium C++ ABI symbol mangling language][manglang]. Note that MSVC mangling language is not supported.
This demangler generates an abstract syntax tree from mangled symbols, which can be used for directly extracting type information, as opposed to having to interpret the C++ source code corresponding to the demangled symbol
There is also a built-in AST stringifier, so the demangler can be used as a replacement for `c++filt` or for formatting backtraces.
[manglang]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
## Requirements
The demangler runs on Python 2.7 and 3.3+ and has no dependencies.
## Installation
Installing via PyPI:
pip install itanium_demangler
Using a local repository for development:
git clone https://github.com/whitequark/python-itanium_demangler
cd python-itanium_demangler
python setup.py develop --user## Usage
```python
from itanium_demangler import parse as demangleast = demangle("_ZN5boost6chrono24process_system_cpu_clock3nowEv")
print(repr(ast))
# , , , )> (,) None>print(ast)
# boost::chrono::process_system_cpu_clock::now()
```## Future considerations
A similar (i.e. also parsing to an AST) implementation of a demangler for the MSVC mangling language would be useful to have.
## License
[0-clause BSD](LICENSE-0BSD.txt)