Related articles |
---|
IBM PC Assembler grammar is wanted!!! sd50020@lanet.lv (Denis) (1998-03-18) |
Re: IBM PC Assembler grammar is wanted!!! lindsay-j@rmc.ca (John Lindsay) (1998-03-20) |
Re: IBM PC Assembler grammar is wanted!!! jhallen@world.std.com (1998-03-20) |
From: | jhallen@world.std.com (Joseph H Allen) |
Newsgroups: | comp.compilers |
Date: | 20 Mar 1998 12:00:43 -0500 |
Organization: | The World Public Access UNIX, Brookline, MA |
References: | 98-03-156 98-03-184 |
Keywords: | parse, assembler, syntax |
Denis wrote:
>> I need IBM PC Assembler YACC grammar as well as lexical analizer.
John Lindsay <lindsay-j@rmc.ca> wrote:
>Me too. The problem here is that there is a huge divergence between
>the syntax, command-line switches and in-line directives, defaults,
>concepts implemented and linker/(os object code) structures supported
>in all the PC assemblers. There's a hot thread in alt.lang.asm and
>comp.lang.asm.x86 about this sort of thing.
>I know of the folowing:
> MASM (several versions)
> TASM (several versions)
> A86
> NASM
> ALP (OS/2 32-bit only).
>There's almost certainly more; can anyone add to this list ?
wasm (from Watcom)
If you're interested in MASM, there's a grammar printed on the last page of
the reference manual for MASM 6.11. I have no idea if it's accurate enough
for a parser. Why would you want to implement MASM anyway? It's a
nightmare. You should be creative and invent a new version: I was thinking
of using a C-like syntax to resolve x86 addressing ambiguities:
mov *(short *)si, 3
mov *(char *)si, 3
mov *(bp+bx), ax
or what the heck, even:
*(short *)si=3
This would mix nicely with the high level directives (.if, .for,
etc.). The real benefit would be that you could use real C structure
declarations which would simplify mixed language programs:
struct foo { int a; char b; };
struct foo var;
mov si,&var
mov al,((struct foo *)si)->b
mov bx,var.a
--
/* jhallen@world.std.com (192.74.137.5) */ /* Joseph H. Allen */
int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)
+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2
]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);}
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.