Re: Mixing mmix and C code?

Luciano <>
16 Oct 2006 09:45:04 -0400

          From comp.compilers

Related articles
Mixing mmix and C code? (Luciano) (2006-10-10)
Re: Mixing mmix and C code? (Tommy Thorn) (2006-10-11)
Re: Mixing mmix and C code? (Luciano) (2006-10-16)
Re: Mixing mmix and C code? (Tommy Thorn) (2006-10-17)
Re: Mixing mmix and C code? (Daniel C. Wang) (2006-10-17)
Re: Mixing mmix and C code? (glen herrmannsfeldt) (2006-10-17)
Re: Mixing mmix and C code? (Tommy Thorn) (2006-10-19)
| List of all articles for this month |

From: Luciano <>
Newsgroups: comp.compilers
Date: 16 Oct 2006 09:45:04 -0400
Organization: Universitaet Hannover
References: 06-10-034 06-10-050
Keywords: C, interpreter
Posted-Date: 16 Oct 2006 09:45:04 EDT

On 11 Oct 2006, Tommy Thorn wrote:

> Luciano wrote:
> > I am intersted in the mmix language by Donald Knuth. Is there a way
> > to call to routine that I write in mmix from C, or is there an mmix to
> > C converter?
> >
> > Thanks
> > Luciano
> > [I see that Knuth has an mmix interpreter written in C. Perhaps you
> > can modify that to make it a callable library. -John]
> Luciano, the question is a bit unclear. First, MMIX is strictly
> speaking not a language, but a microprocessor architeture. Most
> likely, you do not want to be writing in the binary code that is the
> machine code language of MMIX.
> If you're using the mmix-gcc and wish to mix assembly to C code, then
> that's completely standard. You can either inline assembly with the
> usual asm() syntax, eg. asm("ADDI $2,$5,8") or write an complete
> assembly file and with with that.
> If you wish to instrument the simulator (as John implies), then it is
> not that hard at all to modify the MMIX simulator. However, if you need
> access to all of MMIX (notably the priviledge instructions) then you
> need to modify the pipeline simulator MMMIX, which is a non-trivial
> exercise.

Thanks a lot, first!

I try to reformulate my wish better:
How do I code an MMIX example program in such a way that it becomes a
subroutine inside a C-language program?
That is, is it possible to do something like this

int fatt(int);
main (){
int i,j;
printf ("fatt(%d)=%d\n",i,j);
int fatt (int){
/* here I write the code
possibly taken from Knuth's books
     with little extra converting effort

I use Linux :-)
[It's not going to be easy. You'll have to figure out some way to
package up the MMIX simulator as a callable routine or library. My
suggestion is don't do that, back up a step, and tell us what you are
trying to accomplish. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.