[cfe-dev] invoking clang lexer + parser only
Richard Smith
richard at metafoo.co.uk
Tue Aug 28 06:24:21 PDT 2012
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/84f92758/attachment.html>
More information about the cfe-dev
mailing list