<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#333333" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p><br>
    </p>
    <p>I want to do my first modification of clang with a simple case
      (at least from my point of view). What I expect from this thread?
      At least one of this points:<br>
    </p>
    <p>- 1. General overview of the process I should do (eg. you have to
      alter the Lexer and Parser: modify X,Y methods of class Z, then
      expand the class J with support of the X's new output).<br>
    </p>
    <p>- 2. To be pointed to some classes/methods/functions that are
      connected with what I want to achieve (eg. your problem is similar
      to achieving '<<< >>>' for Cuda, read the files
      X, Y, Z related with CUDA).<br>
    </p>
    <p>- 3. Alternative strategies (eg. you will suffer doing it in this
      way, much better expanding the Lexer and avoiding to touch the
      CodeGen).<br>
    </p>
    <p><br>
    </p>
    <p>As you can imagine I wrote stupid (eg.) examples.<br>
    </p>
    <p><br>
    </p>
    <p>My objective is being able to transform every code like this:</p>
    <p>> "A: #{A} B: #{B}\n"</p>
    <p>to this:</p>
    <p>> "A: " << A << " B: " << B << "\n"<br>
    </p>
    <p><br>
    </p>
    <p>So, in cases like this:</p>
    <p>> std::cout << "#{var}\n";</p>
    <p>will make sense:</p>
    <p>> std::cout << var << "\n";</p>
    <p><br>
    </p>
    <p>But others like:</p>
    <p>> printf("#{var}\n"); auto x = "my string#{x}";<br>
    </p>
    <p>not:</p>
    <p>> printf(var << "\n"); auto x = "my string" << x;<br>
    </p>
    <p><br>
    </p>
    <p>But I don't mind. It is a "simple example" to start learning how
      to modify clang.</p>
    <p><br>
    </p>
    <p>So, my initial strategy would be to receive a string (the source
      code) and transform it as raw text, using regexp or not (not
      important). <br>
    </p>
    <p><br>
    </p>
    <p>I think that I should receive the source code, maybe just before
      the preprocessor, do the transformations to every source code (eg.
      I receive the source code per file) and just leave it to the next
      phase of the compiling process.</p>
    <p><br>
    </p>
    <p>Any recommendation? (steps 1, 2 and 3 that I posted above).</p>
    <p><br>
    </p>
    <p>Thanks in advance,</p>
    <p>rNoz</p>
    <p><br>
    </p>
    <p>This thread is opened after solving the problem of compilation
      speed. Now is affordable :) Thanks to all in "Too much time to
      compile clang. Suggestions for a starter?".<br>
    </p>
  </body>
</html>