Well, it's an option. I could write some simple programs in Pascal and see what assembly code is being generated.
But I think it should be a formal document with this step. I mean, when somebody implements a compiler, he/she must follow several steps: lex, parsing, generation of symbol table and object code generation. Well, I search for a scheme with the correspondencies between the structures being parsed and the code generated.
E.g.:
program: program id other body; --> initialize memory
body: begin instructions end ';' --> generate instructions 'enter', 'leave'
...
I'm not interested in sources of GPC, because GPC is designed as a front-end, and I search for the back-end...
Thanks for the patience!
Mensaje citado por: Maurice Lombardi Maurice.Lombardi@ujf-grenoble.fr:
Eike Lange a écrit:
Hi!
On Wed, Dec 11, 2002 at 09:00:46AM +0000, a2782@dis.ulpgc.es wrote:
to think that a compiler generates an object code (or intermediate code) from a source code in several phases... but it seems that
this
definition is wrong! Anyway, I need to convert a Pascal source in a i386 code. The Translation Scheme for this would be useful for me.
I do not know, what "Translation Scheme" means, but if you have some Pascal code like:
program Hello;
begin WriteLn ('Hello, World!') end.
in a file called "hello.pas" You just have to run a compiler, such
as
the GNU-Pascal Compiler with: gpc hello.pas -o hello to produce an executable.
May be you want an assembly listing ?
then type
gpc -S hello.pas
you will obtain hello.S
But you may have a surprise: it is AT&T assembly syntax, not any
variant
of intel syntax. I do not know if there is any way to convert (or to
output
it directly).
Maurice
-- Maurice Lombardi Laboratoire de Spectrometrie Physique, Universite Joseph Fourier de Grenoble, BP87 38402 Saint Martin d'Heres Cedex FRANCE Tel: 33 (0)4 76 51 47 51 Fax: 33 (0)4 76 63 54 95 mailto:Maurice.Lombardi@ujf-grenoble.fr