[llvm-dev] Potential ambiguity in the grammar of LLVM IR assembly

Robin Eklind via llvm-dev llvm-dev at lists.llvm.org
Wed May 25 16:10:32 PDT 2016


Hello everyone,

While developing a parser for LLVM IR, I seem to have stumbled upon a 
potential ambiguity in the LLVM IR assembly language grammar. Most 
likely there is something which I may have overlooked, so wanted to 
reach out to a more experienced crowed for some feedback.

How would the following set of tokens be interpreted [1]?

declare
void
@foo()
unnamed_addr
global
i32
42

As far as I can tell, both of the following representations are valid in 
the grammar [2]

declare void @foo() unnamed_addr
global i32 42

and [3]

declare void @foo()
unnamed_addr global i32 42

Is the grammar ambiguous, or is there something that I've overlooked?

Hope to hear back from you.

With kind regards,

Robin Eklind

[1]: https://github.com/mewspring/poc/blob/master/ll/a.ll
[2]: https://github.com/mewspring/poc/blob/master/ll/a1.ll
[3]: https://github.com/mewspring/poc/blob/master/ll/a2.ll


More information about the llvm-dev mailing list