Hello Tom,
great to hear about your interest. Unfortunately I do not have any
experience in generating IA-32 assembler (or any other assembler). I
have only programmed front-end and optimisation passes of real compilers.
None of my compiler books says much concrete about assembler code. Note
also that we target a stack machine, real processors have a slightly
different instruction set, using the stack only for function calls and
argument passing, but the registers for storing intermediate results.
"modern compiler implementation in Java" by Andrew Appel says more about
producing code for a standard processor. However, the book hardly
mentions assembler. There is supposed to be lots of code and
documentation on the web, but the link on the Cambridge University Press
site doesn't work. (Maybe ask the author?)
Our library doesn't seem to have any recent books on assembler
programming. Bob Eager might be a good person to ask for information.
I suppose you already found the following websites:
http://asm.sourceforge.net/
http://www.faqs.org/faqs/assembly-language/x86/general/part3/section-1.html
An alternative to producing IA-32 assembler would be to produce Java
byte code, using Jasmin. http://jasmin.sourceforge.net/
Yet another idea would be to target transputer bytecode. A group of
people in the department developed the transterpreter, and hence they
have some expertise in producing transputer bytecode.
http://www.transterpreter.org
If you are interested in this topic, maybe you want to do your final
year project in this area? I'm interested in getting a small functional
language with Erlang-like communicating processes running on the Lego
Mindstorms. Originally I thought of compiling to the transterpreter, but
now I tend more towards an interpreter in C for a Scheme-like language.
That would be more flexible but also require writing the schedular for
the concurrent processes. I'm open to other suggestions.
Please tell me how you are getting on with your code generation and
whether I can help you with some issue.
Ciao,
Olaf
tpc4@kent.ac.uk wrote:
>Hi,
>
>I finished off the assessment 4 for the CO524 module a couple of days ago
>and have since then been trying to work out how assembly actually works,
>with the ultimate goal of producing an executable that I can actually run.
>Do you have experiance of this "final step" of compiler writing? I found a
>couple of books in the library about compilers that do have a lot of
>practical stuff about writing the parser, lexical analyser and such but
>nothing about making an actual executable.
>
>Could you point me in the right direction? I've so far had a quick look at
>nasm and the GNU "as" assemblers, but for both of those there seems to be
>a wealth of "Hello World" programs online but nothing much more useful!
>
>Yours, inquisitively...
>
>Tom Carlson
>
>
>