Gopal V wrote:

If memory serves me right, Leopold Toetsch wrote:

Is there any other way to feed imcc code other than via writing to a
file and running it ?...

Not currently.


Dan was saying something like a C interface to IMCC which bypasses the
parser and lexer phases was possible ?

Yes. But there is nothing defined now.

The 2 basic structures of a parsed code stream in imcc are:
- struct _Instruction
- struct SymReg
along with some flags.

And there is (almost) only one function iANY() which takes a **SymReg and an opcode to generate the instruction stream. So it probably wouldn't be to hard to build the interface here.


The problem grows as the number of languages supported increases ...

Yes, but I think, that incompatible changes shouldn't be necessary any more - sorry for breaking things.


I really would like something like this (shameless snitch)

IMCC_Var *tempVar ;
IMCC_Expr *expr;
tempVar = IMCC_GenTempVar(code,type);

SymReg *r = mk_ident(char *name, char type)


expr = IMCC_GenAdd(code,myParam1,myParam2);

iANY("add", R3(r0,r1,r2))


IMCC_GenAssign(code,tempVar,expr);

iANY("set", R2(r, r0))


IMCC_GenIf(code,tempVar,thenStmt);

iANY("if", R2(r, thenr))


IMCC_ReleaseTempVar(code,tempVar);

namespace patch


IMCC_GenCode(code,fp);

above iANY()s append the generated instructions to the double linked instruction list.


Gopal

leo




Reply via email to