Skip to main content

Pure Python parser for mangled itanium symbols

Project description

# 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.


## 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
cd python-itanium_demangler
python develop --user

## Usage

from itanium_demangler import parse as demangle

ast = demangle("_ZN5boost6chrono24process_system_cpu_clock3nowEv")

# <FuncNode func <Node qual_name (<Node name 'boost'>, <Node name 'chrono'>, <Node name 'process_system_cpu_clock'>, <Node name 'now'>)> (<Node builtin 'void'>,) None>

# 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)

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for itanium_demangler, version 1.0
Filename, size File type Python version Upload date Hashes
Filename, size itanium_demangler-1.0.tar.gz (6.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page