[LLVMdev] LLVM grammar for ANTLR

Surinder surifilms at gmail.com
Mon Jan 24 22:00:42 PST 2011


Hi Sam,

Thanks for your reply.

I am implementing my research
(http://www.it.usyd.edu.au/~suri/Detecting%20Buffer%20Over.pdf), a
translation of LLVM to a simple non-deterministic language to detect
buffer overflows.  It involves

(1) printing a control flow graph of basic blocks of a function (easily done)
(2) translating each llvm statement to a corresponding data flow
language (needs ASTs to traverse)
(3) translating control flow graph to a regular expression
(4) translating data flow language statements to non-deterministic language
(5) translating non-deterministic language to CLP (Prolog like solver)
(6) finding a Prolog solution as proof of or absence of buffer overflows

I have implemented Step (1) & (2) above by writing a transform pass.
Remaining steps (3) to (6) have been written in Haskell.  Step (2),
translation from llvm to dfl language has been done by implementing an
AnnotationWriter and it emits dfl format of each llvm statement.  This
is rather crude and causes crashes between llvm/haskell interface.  I
am considering to dump llvm as it is into Haskell program and then use
a parser tool to do llvm statement translation to dfl.  The
translation is a set of simple rewrite tools.

You can get further details from my website
http://it.usyd.edu.au/~suri or you can ask me.

Thank you for your interest.

Surinder

On Tue, Jan 25, 2011 at 3:22 AM, Samuel Crow <samuraileumas at yahoo.com> wrote:
> Hello Surinder,
>
> The existing hand-written parser is callable from almost anywhere so the only
> reason you'd need to have a parser for it would be to extend it.  Originally it
> was written using Flex and Bison but Chris Lattner rewrote it from scratch to
> catch more errors at the parsing stage.
>
> The only feature I've found to be missing from the existing LLVM-AS utility was
> an include function with automatic unique detection.  This would allow the use
> of headers instead of having to manually copy and paste them into the source.
>  What were you planning on doing with your LLVM parser, if I may ask?
>
> --Sam
>
>
> ----- Original Message ----
>> From: Surinder <surifilms at gmail.com>
>> To: llvmdev at cs.uiuc.edu
>> Sent: Sun, January 23, 2011 10:35:38 PM
>> Subject: [LLVMdev] LLVM grammar for ANTLR
>>
>> Has anyone written a grammar for LLVM for ANTLR.  I mean an  ANTLR
>> grammar that parses LLVM instructions.  Is an LLVM grammar  available
>> for any other parsing  tool?
>>
>> Surinder
>
>
>
>




More information about the llvm-dev mailing list