<div dir="ltr"><div><div><div>Hie Mahesha.<br></div>Thanks for this information. I want to know that from where should I get information about Clang's preprocessor. To be specific I want to know where are the tokens specified in the code. I have searched the clang's documentation, but not able to find the right code for me to start.<br>
</div>Thanks <br></div>Surbhi<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 12:19 PM, Mahesha HS <span dir="ltr"><<a href="mailto:mahesha.llvm@gmail.com" target="_blank">mahesha.llvm@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>1. You have to spend considerable amount of time playing with Clang (for that matter with any software) in order to know its internals.<br>
<br></div>2. Based on my understanding of your previous mail,  as a first step, it looks like, you have to preserve comments in the original C program which Clang preprocessor probably throws away.<br>
<br></div>3. Then, probably you have to come-up with a mechanism to parse comments, to represent them as AST nodes, and further processing of these ASTs as per your requirements.<br><br></div>4. In my opinion, it could involve considerable amount work to tune Clang before it accepts your ASCL programs. Being said that, I am not an expert in Clang. Please consider other's opinion.<br>

</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Jul 18, 2013 at 11:24 AM, surbhi singh <span dir="ltr"><<a href="mailto:surbhi.chauhan011@gmail.com" target="_blank">surbhi.chauhan011@gmail.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div> Hie Everyone.<br>I want to to produce LLVM-IR for ACSL programs using CLANG. I am new to<br>
CLANG and don't know much about it. What I am looking for is how to learn about architecture of CLANG so that I can make changes in its source code so as to make it support for my ACSL constructs. This language is a specification language<br>


of C. The specifications of the program are written in annotated comments. I want to produce LLVM-IR for such type of code using clang. For this I think I have to add some code in the existing source code of clang. So, what I want to know is learn about clang so as to know what changes to make in it and where. I am writing one simple ACSL program :<br>


<br><pre style="word-break:normal!important;word-wrap:normal!important;white-space:pre!important"><span>/* Program verification examples from the book "Software Foundations"
   <a href="http://www.cis.upenn.edu/~bcpierce/sf/" target="_blank">http://www.cis.upenn.edu/~bcpierce/sf/</a>

   Example: Reduce to Zero
*/</span><span>

</span><span>int</span><span> reduce_to_zero </span><span>(</span><span>int</span><span> x</span><span>)</span><span>
</span><span>/*
  @requires { x >= 0 }
  @ensures { result = 0 }<br></span><span>*/</span><span>
</span><span>{</span><span>
    </span><span>while</span><span> </span><span>(</span><span>x </span><span>!=</span><span> </span><span>0</span><span>)</span><span> </span><span>{</span><span>
        </span><span>/*
          @invariant { x >= 0 }
          @variant { x }
        */</span><span>
        x </span><span>=</span><span> x </span><span>-</span><span> </span><span>1</span><span>;</span><span>
    </span><span>}</span><span>
    </span><span>return</span><span> x</span><span>;</span><span>
</span><span>}</span><br></pre><br>The "requires" annotation ensures that the caller of the function reduce_to_zero() has value of the parameter >= 0 and the "ensures" annotation ensures that the function reduce_to_zero() has result = 0 before it ends its execution. <br>


This is one of the programs for which I want to produce LLVM-IR.<br>I had studied internal manual on clang but din't find it much useful as<br>concerned to my work. I was reading the documentation of clang but I don't think its a great start for beginner's like me.<br>


I had done a course on compiler design as part of my academics and know the basics of lexing, parsing, semantic analysis and compiler architecture. Apart from this, this is my first practical experience with compilers.<br>


This is a part of my academic research work(B.Tech) on compilers which I might continue further as I like this part.<br>Please help me with this as I am seriously interested in working with clang.<br></div>Thanks in advance.<span><font color="#888888"><br>


</font></span></div><span><font color="#888888">Surbhi<br></font></span></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div>mahesha</div>
</font></span></div>
</blockquote></div><br></div>