   compiling a pascal program into a C code
  hi,    how do i convert a pascal program into a C code that is the intermediate representation of the program [the three-address codes in C]? i have the pascal grammar and the lex conventions. i know how to use LEX & YACC? but how do i generate the three-address statements[quadruples]and direct them into a .c file which i can then compiler using a C compiler?   
  What are these "three-address statements"? Converting pascal to C should be reasonably straightforward, but still won't be that easy.   ;  Probably this. But I'm not sure what you mean, magneeto, when you want to generate these. Given the Pascal(-ish) statement:z := x + y;What is it that you want? The equivalent C statement?z = x + y;Or a quadruple like?(+,x,y,z)Because your statement "a C code that is the intermediate representation of the program" seem nonsensical. C doesn't have language-level support for any kind of TAC representation, so you cannot produce "an intermediate representation" of the program that will be compilable C code. You can convert Pascal statements to equivalent C statements, but that isn't neccessarily a TAC representation.I'm really not clear what you are trying to do... If you are trying to write a compiler for Pascal, why compile to C as an intermediate language? It seems that TAC is used for aiding optimizations during compile time, but if thats what you are using it for, converting it into a chunk of C code won't make your life easier -- you should probably convert it into the quadruple form and optimize based on that.   ;  let me clarify a little bit. i got the idea from the dragon book [Compilers principles, techniques and tools by aho, sethi and ullman]. in appendix A of the book the authors gave the syntax of a pascal subset [an LALR(1) grammar]and also the lexical conventions. then they suggested an exercise asking to translate a source program written in pascal into an intermediate representation such as quadruples[a form TAC] and then interpreting the intermediate representation. they suggested that each quadruple can be a statement of a high-level language such as C. the output of the compiler is then a sequence of C statements that can be compiled on an existing C compiler. i don't know how to write these quadruples that will be C statements. i only know how they r represented in the form x := y op z.   ;  Ah. Well, I don't know enough about the subject to say definitively, but I suppose they mean for you to generate a lexer/parser that will break up compound expressions that cannot be represented as a TAC (such as w := x + y + z) into quadruples, then generate equivalent C statements for the quadruples (so (+,x,y,z) would become the C statement z = x + y;). But perhaps somebody more knowledgeable in the subject area can help.   ;  u got it jpetrie. i'm still searching for some help and studying to try it myself. anything would be helpful   