[cfe-dev] Clang parser diagnostics

Jean-Daniel Dupas devlists at shadowlab.org
Sun Aug 23 03:07:45 PDT 2009


Le 23 août 2009 à 11:37, Jean-Daniel Dupas a écrit :

>
> Le 22 août 2009 à 06:53, Ken Camann a écrit :
>
>> Hello everyone.
>>
>> First, let me say I'm very impressed with both the clang and LLVM
>> projects.  The quality of the clang source code is so good that I've
>> learned a lot about how compilers work just from reading it.
>>
>> In fact, I am writing a compiler for a different language using clang
>> as a sort of "design guide".  So far I've gotten to the parser, and
>> I've noticed something interesting about the way clang generates  
>> parse
>> error diagnostics.
>>
>> If you type something like:
>>
>> "x = 3 * * 4"
>>
>> it will point to the second "*" and say "expected expression",  
>> because
>> a node for the operator precedence parser was expected.  However,  
>> this
>> is not really in keeping with the design philosophy of very  
>> expressive
>> error messages.
>
>
> How do you get this message ? :
>
> --------
> int test() {
> 	int x = 3 * * 4;
> 	return x;
> }
> -----------
>
> test.c:3:12: error: indirection requires pointer operand ('int'  
> invalid)
>         int x = 3**4;
>
>

OK, '*' is a special case, I got it with '/' or another operator.








More information about the cfe-dev mailing list