Grammar for x86 assembly

  • Follow


Does anyone know of a grammar to parse x86 assembly code?

lex/yacc stuff would be even better.

Thanks,

-Ram

0
Reply Ramkumar 6/10/2004 7:20:44 PM

On Thu, 10 Jun 2004 19:20:44 +0000 (UTC), Ramkumar Chinchani
<rc27@cse.buffalo.edu> wrote:

>
>Does anyone know of a grammar to parse x86 assembly code?
>
>lex/yacc stuff would be even better.

For MASM there is a BNF grammar in the back of the Programmer's Guide,
version 6 & 6.1.  Complete with errors.

-- 
Arargh405 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the garbage from the reply address.

0
Reply arargh405NOSPAM 6/10/2004 9:53:01 PM


"Ramkumar Chinchani" <rc27@cse.buffalo.edu> wrote in message
news:Pine.SOL.4.56.0406101446180.12346@pollux.cse.buffalo.edu...
>
> Does anyone know of a grammar to parse x86 assembly code?
>
> lex/yacc stuff would be even better.
>

HLA (the High Level Assembler) was written with Flex & Bison.
Source code is available at:
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

Having written an assembler with those tools, I can say
without hesitation that they are *not* the most appropriate
tools for the job.
Cheers,
Randy Hyde

0
Reply Randall 6/11/2004 4:17:53 AM

You would be going to improve on the Intel data in Manual2 of the PIV
set of manuals. It has the data you require in detail. Prefix, opcode,
ModRM, SIBbyte, displacement, immediate.

The fun part is in recognising the different combinations before you
extract the data from the tables you need to write.

Regards,

hutch at movsd dot com

0
Reply hutch 6/11/2004 5:41:39 AM

Ramkumar Chinchani <rc27@cse.buffalo.edu> wrote:
>
>Does anyone know of a grammar to parse x86 assembly code?
>
>lex/yacc stuff would be even better.

If I may be picky for a moment, there is no such thing, because each
assembler uses a slightly different grammar.  You could ask for a MASM
grammar, or a TASM grammar, or a gas grammar, or an HLA grammar, or a NASM
grammar, but there is no "x86 assembly code" grammar.
-- 
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.

0
Reply Tim 6/12/2004 5:58:47 AM

4 Replies
450 Views

(page loaded in 0.068 seconds)

Similiar Articles:













7/20/2012 5:13:13 PM


Reply: