in ,

Dave Prosser's C Preprocessing Algorithm, Hacker News

  

For about five years I’ve been trying to implement a fully conforming C preprocessor for the front end of the CScout refactoring browser. I’ve found this to be a fiendishly difficult task. Although what I have written can correctly process million-line real-life projects, every once in a while I come across a construct that confuses my implementation. While searching the web for explanations of some of the finer points of the C standard I came across a reference to an algorithm by Dave Prosser that the X3J 11 (ANSI C standard) committee used as a basis for the standard’s wording.

I could not find the algorithm published or online, but following an email Dave kindly dug in his files, and sent me the original troff source and an ASCII document with some explanations and two bug fixes. I used the ASCII document to create an updated version of the original document. Dave also gave me permission to put the algorithm online, so here are the two versions typeset into PDF.

      The original X4J / 90 – document

    • A corrected and annotated version of the X4J (/ 90 – document

     

    Read and post comments , or share through

            
    Brave Browser (Read More

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

If your cipher were secure, this image wouldn't have obvious repeating patterns, Hacker News

Dubai-based man with Dh65,000 in traffic fines pays zero