Respected Sir/Madam,
As I was developing some part of compiler for a project. I require grammar
(BNF or EBNF) for converting the C code in the IR as it is not been
mentioned any where over your official website.
Awaiting for your help.
Regards,
Vijay Daultani.
M.Tech student
IIT Delhi
Vijay Daultani wrote:
Respected Sir/Madam,
As I was developing some part of compiler for a project. I require grammar
(BNF or EBNF) for converting the C code in the IR as it is not been
mentioned any where over your official website.
I don't know what you mean by "converting the C code in the IR".
Regardless, LLVM does not have BNF or EBNF forms (or any formalized grammar) for C, nor for LLVM IR. Sorry!
Nick
I am curious how do you guys do it anyways?
Do what ? compile C code ?
You have to use clang which is the LLVM C language family frontend.
See http://clang.llvm.org/
Hi Vijay,
If you are asking about compiling C into LLVM IR - take a look at Clang:
http://clang.llvm.org/. Clang is a C, C++ and ObjC front-end for LLVM.
Eli
Seems that Vijay is asking about converting C program to LLVM IR
From: llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
On Behalf Of Devchandra L Meetei
Subject: Re: [LLVMdev] Require Grammar for converting C to IR
> If you are asking about compiling C into LLVM IR - take a look at Clang:
> http://clang.llvm.org/. Clang is a C, C++ and ObjC front-end for LLVM.
Seems that Vijay is asking about converting C program to LLVM IR
Which is exactly what clang does, hence the previous answer from Eli.
- Chuck
We seem to have a communication breakdown. My quick answer was also "look
at Clang", though it seems they're asking for something different...
As far as I know, there isn't any C/C++ EBNF -> LLVM IR parsers available,
as there aren't crazy enough folks out there... 
A few hints:
* If you're looking for the EBNF description of C/C++, google for "C++
ebnf" and you'll find plenty.
* If you need a compiler for C/C++, look at Clang, and you'll find a great
implementation.
* If you're looking for a tool that gets a C/C++ grammar and transforms
into a parser (like bison), you may find examples at the Gnu Bison docs.
You can than use that to convert your AST to LLVM IR, but you'll have to
hand-code the bridge yourself.
cheers,
--renato