[cfe-dev] How to make clang compile any other language ? I want it to support ACSL (specification language of C).)
surbhi singh
surbhi.chauhan011 at gmail.com
Wed Jul 17 22:54:26 PDT 2013
Hie Everyone.
I want to to produce LLVM-IR for ACSL programs using CLANG. I am new to
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
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 :
/* Program verification examples from the book "Software Foundations"
http://www.cis.upenn.edu/~bcpierce/sf/
Example: Reduce to Zero
*/
int reduce_to_zero (int x)/*
@requires { x >= 0 }
@ensures { result = 0 }
*/{
while (x != 0) {
/*
@invariant { x >= 0 }
@variant { x }
*/
x = x - 1;
}
return x;}
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.
This is one of the programs for which I want to produce LLVM-IR.
I had studied internal manual on clang but din't find it much useful as
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.
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.
This is a part of my academic research work(B.Tech) on compilers which I
might continue further as I like this part.
Please help me with this as I am seriously interested in working with clang.
Thanks in advance.
Surbhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130718/bed23b49/attachment.html>
More information about the cfe-dev
mailing list