<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 7, 2015 at 6:16 PM, Jovi Zhangwei <span dir="ltr"><<a href="mailto:jovi.zhangwei@gmail.com" target="_blank">jovi.zhangwei@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Yes, I just need C, completely don‘t need any C++ and other extension, clang internal looks have more complexity than I need.</p>
<p dir="ltr">Do you have any guide on how to write C frontend based on LLVM? any project can take reference other than clang?</p></blockquote><div>FYI, clang started out as a C compiler before it grew C++ support. Check back (way back) in the history.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr"> I looked into tcc before, but it seems it's not fully C completely. actually I'm totally new to compiler, but I really want to build that tracing tool based on bpf.</p>
<p dir="ltr">Thank you.</p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">Jovi<br>
</p></font></span><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Jan 7, 2015 5:58 PM, "Reid Kleckner" <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If you just want C and not C++ or other language extensions, then I think writing your own C frontend IR is probably easier than reusing Clang's. All the complexity in Clang comes from C++, really, and the frontend isn't designed to be pluggable like the optimizer is.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 7, 2015 at 5:36 PM, Jovi Zhangwei <span dir="ltr"><<a href="mailto:jovi.zhangwei@gmail.com" target="_blank">jovi.zhangwei@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On Wed, Jan 7, 2015 at 4:55 PM, mats petersson <<a href="mailto:mats@planetcatfish.com" target="_blank">mats@planetcatfish.com</a>> wrote:<br>
> And you want to DO what, exactly with it, after you have parsed it?<br>
><br>
> And does your script use ALL of C's functionality?<br>
><br>
<br>
Some functions will be compiled to bpf bytecode and inject into<br>
kernel(run in kernel), some functions<br>
in one script will be compiled to x86_64 instruction which run in userspace.<br>
<br>
(There have one project called ktap, <a href="http://www.ktap.org" target="_blank">www.ktap.org</a>, mainly purpose for<br>
kernel dynamic tracing, probably you knows systemtap,<br>
ktap is similar like systemtap. There will have a bpf backend for<br>
llvm, now I'm just think how to integrating ktap and bpf)<br>
<br>
Some basic requirement of this new frontend is:<br>
1). support new keywords, like trace, trace_end, argstr.<br>
2). support table syntax, also multiple key table. C language don't<br>
support table syntax at all.<br>
3). data structure info retrieve from debuginfo(like vmlinux), not<br>
defined in script or header file.<br>
<br>
Do you think my design can achieve by change some part of clang(lex,<br>
etc) and reuse rest library of clang? or have better solution?<br>
<br>
Thank you.<br>
<span><font color="#888888"><br>
> --<br>
> Mats<br>
</font></span><div><div>><br>
> On 7 January 2015 at 23:58, Jovi Zhangwei <<a href="mailto:jovi.zhangwei@gmail.com" target="_blank">jovi.zhangwei@gmail.com</a>> wrote:<br>
>> Hi,<br>
>><br>
>> On Tue, Jan 6, 2015 at 4:16 PM, Nikola Smiljanic <<a href="mailto:popizdeh@gmail.com" target="_blank">popizdeh@gmail.com</a>> wrote:<br>
>>> Yes, you'd have to modify clang to lex/parse/sema your<br>
>>> keywords/extensions/whatever.<br>
>>><br>
>><br>
>> Is there have a simple solution without change to much on clang?<br>
>><br>
>> In my case, I want to parse script which have custom language based on<br>
>> C. The script just like below:<br>
>><br>
>> trace syscalls:*<br>
>> {<br>
>> print(argstr);<br>
>> }<br>
>><br>
>> Actually there just have few new keywords(like trace, trace_end) in<br>
>> this new language, all others in C.<br>
>><br>
>> Any guide on this?<br>
>><br>
>> Thank you.<br>
>><br>
>>> On Wed, Jan 7, 2015 at 10:15 AM, Jovi Zhangwei <<a href="mailto:jovi.zhangwei@gmail.com" target="_blank">jovi.zhangwei@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Hi,<br>
>>>><br>
>>>> I'm new to clang world, here I have one question about libclang or<br>
>>>> libtooling, I would be very appreciate if anyone can help me.<br>
>>>><br>
>>>> Currently I want to develop a new language, which is C like, just some new<br>
>>>> syntax sugars on top of C language, I can modify clang lexer code to make<br>
>>>> that, or I can use translator, but if this requirement can be done by<br>
>>>> libclang or libtooling, that's perfect simple for me.<br>
>>>><br>
>>>> My direct impression is there have no way to change language syntax by<br>
>>>> libclang/libtooling, libclang/libtooling only can parse and analysis on C<br>
>>>> family language, no chance to support other language by library, is this<br>
>>>> correct?<br>
>>>><br>
>>>> Thank you.<br>
>>>><br>
>>>> Jovi<br>
>>>><br>
>>>> _______________________________________________<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>
>>><br>
>> _______________________________________________<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>
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>
</div></div></blockquote></div><br></div>
</blockquote></div>
</div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">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><br></div></div>