Compilers: Principles, Techniques, and Tools (2nd Edition)
Damn, whenever you get to studying compilers this will be crazy to look back to.
Anyway you are probably not in the level of building a C compiler from scratch.
So think of it this way, you need to have a set of instructions and yes you will have to go through the program string and transform the string into MIPS instructions.
The most naive way to do it and it might be what your teacher expects unless it is a compiler course, would be to parse the program text line by line as it is expected to be a simple program and as you said have a lot of conditions for each type of expression that you will evaluate.
A tip: Save for / while loops as a label as soon as you read them and from there you need to check where is the endpoint of it for the jump when necessary (completed for/while conditions etc)
Now if it is a compiler project. I'd strongly recommend you read into this book:
Compilers: Principles, Techniques, and Tools
Because to build a real compiler you need to understand all the stages of a compiler and how does it work together... You would also need to know some Language Theory.
The Abstract Syntax Tree of different languages are usually not compatible. This is the case because the AST represents the code that has been written in the respective language. That means you could traverse the tree and format it to code with identical syntax again (i.e. the whitespaces will differ, the rest is the same). However they cannot be compatible, because the languages have different constructs. For example Groovy has closures which is not the case for Java. You can usually find a mapping to different concepts that will be equivalent, but that's not the point of an AST.
The reason AST transformations are a part of Groovy whereas they are not part of Java is the same closures are part of Groovy but not of Java: different design decisions. Java was designed to be simple. Easy to get into and easy to read albeit often verbose. Groovy had a different focus. The syntax is more concise and things like domain specific languages are desired.
If you are more interested in the internals of compilers I recommend the "Dragon Book". It's as far as I know the standard you read in academics (I read it when I was studying).
Yes, you can certainly use lex and yacc to build a compiler/translator for a programming or scripting language. There are GNU variants of these tools, called flex and bison. John Levine's lex & yacc was for many years the gold standard for books about these tools. That book may be out of print, but I expect that the successor book, Flex & Bison, is just as good. To dig deeper into building a compiler, start with Aho et al., Compilers: Principles, Techniques, and Tools, 2/e. (Again, my recommendation is based on the first edition of this book.)
Should have gotten her this dragon book so she can get a headstart on writing compilers.
Was expecting this dragon book
She's trying to hide her disappointment. I'm pretty sure this is the one she wanted .
That proof isn't a problem in the book; it's mentioned, with a hint for those inclined to derive it themselves, in the running text.