[cfe-dev] invoking clang lexer + parser only

Ali Javadi aj14889 at yahoo.com
Tue Aug 28 10:39:21 PDT 2012


So basically I need to add the semantics and AST nodes for my new expression as well, because -"fsyntax-only" uses those.
I read somewhere that adding an attribute has the advantage of propagating through the code, and I might not therefore need to add AST support. Is that right? In general would it be easier to accomplish syntax checking by adding some attributes?

Thanks for you help,
Ali

On Aug 28, 2012, at 9:24 AM, Richard Smith wrote:

> On Tue, Aug 28, 2012 at 6:13 AM, Ali Javadi <aj14889 at yahoo.com> wrote:
> I am writing a syntax checker for a new language using the clang front-end. I have added some keywords and some grammar rules, but I don't know how to invoke the tools down to the level of parsing only. I am merely interested in checking the correctness of syntax at the moment.
> 
> I tried ParseAST(), but that returns a NULL pointer for the new type definitions, since their semantics are not defined. What other option do I have?
> 
> You could use clang's -fsyntax-only command-line argument to perform only syntactic and semantic analysis steps. There are some other tips here:
> 
> http://clang.llvm.org/docs/InternalsManual.html#AddingExprStmt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120828/9e206225/attachment.html>


More information about the cfe-dev mailing list