[cfe-dev] extend Clang parser.

David Blaikie dblaikie at gmail.com
Fri Sep 20 08:34:31 PDT 2013


On Sep 20, 2013 8:12 AM, "Alejandro Jimenez" <whilealex at gmail.com> wrote:
>
> Hi everyone
>
> I am new to Clang, but I am trying to support the following syntax on
variable declaration for a given language.
>
> int a : qualifier;

You may find this difficult due to ambiguities (bitfields and range based
for loop) with existing c++syntax...

>
> float f(int x : qualifier) : qualifier
> {
>
> }
>
> for qualifier a single word without spaces
>
> Which is the best way to approach?
>
> I see that there is an ASTConsumer, but didnt found any ParserConsumer,
is there anything similar?

Not really. Clang isn't designed to allow pluggable arbitrary language
extensions. Astconsumers are just for pluggable language consumers, they
don't get to change the language.

If you're changing the language you're going to have to change clang's
parsing and sema layers directly.

>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130920/1ab0b984/attachment.html>


More information about the cfe-dev mailing list