Alex Rivera | Logout

Is there BNF-like grammar to describe LLVM IR?

Asked 2011-01-03T04:06:55.230
13

I am wondering that whether there is a BNF-grammar to describe LLVM IR? like C BNF grammar describing C language, etc.

Edit
Report

1 Answer

4

Yes. Go to the file "LLParser.cpp" in "LLVM/lib/AsmParser"; the EBNF is spread throughput the file, for instance, the function LLParser::ParseNamedType() around line 350 has the following function-comment:

/// toplevelentity
///   ::= LocalVar '=' 'type' type
bool LLParser::ParseNamedType() {
  /* impl. */
}

I'm sure a regular-expression would happily extract the EBNF. I'm doing so by hand as I go through the parser.

answered 2011-01-24T18:31:51.060

Your Answer