Skip to content

WIP: proof of concept port of source scanner to pcpp / pycparser

This is partial investigative work related #346 . As a reminder source scanning occurs in two phases: SourceScanner.parse_files() then SourceScanner.parse_macros(), the second being responsible for extracting function macros and evaluating Constant symbols from object macros.

The current state of the branch only reimplements parse_macros(), it is however at feature-parity with the previous implementation as far as the test suite tells me (and actually fixes some bugs while at it, mostly related to evaluation expression / source positions). The code also generates a full Ast based on the output of the preprocessing stage, from a rapid inspection it looks to me like all symbols are available for reimplementing parse_files() but I'm running out of free time and this fulfills the initial objective I had which was to validate viability :)

I think this is pretty exciting stuff, as switching to pure python scanning opens the door to many infrastructure improvements, not least of which would be to get rid of one cause for the circular dependency with the GLib.

I'm putting the code out there looking for comments / testing / evaluation, there's obviously a lot to discuss if we do decide to go down that road.

Merge request reports