arocc icon indicating copy to clipboard operation
arocc copied to clipboard

New preprocessor, work in progress

Open ehaas opened this issue 1 year ago • 0 comments

This is a rewrite of the Preprocessor, based on the algorithm described in https://www.spinellis.gr/blog/20060626/cpp.algo.pdf

Main inspiration was that the existing one doesn't work with some more esoteric cases, such as https://github.com/Hirrolot/metalang99 and was having trouble figuring out why.

Right now it's hidden behind a flag -fnew-preprocessor, and it only preprocesses; it isn't tied into the parser at all. And there is still a lot of work to do - currently I'm not handling expansion locations at all, and there are lots of missing smaller features + probably lots of memory leaks.

One big improvement is using a persistent treap for hideset management, which massively reduces the amount of copying when adding items to a set or performing union/intersection operations.

ehaas avatar Jul 06 '24 16:07 ehaas