24
CS269: HW/SW Engineering of Embedded Systems, Winter02
How to write a back-end?
•STEPS
•1. Write a class implements Backend
•2. Write method invoke() in that class
–define the arguments
–design necessary visitors
•3. Write visitors to traverse ASTs
•4. Add flags to compiler command-line
public class Compiler {
   
    public static void main (String[ ] args) {
         inspectArgs(args);
         initCompiler();
         asts = compileSources();
         backend.invoke( backendArgs, asts);
   }
    public static void inspect args(String[] args) {
   
   
   
             
       
   
}
protected static Backend backend = null;
protected static List backendArgs = new LinkedList();
protected static String[ ] helpMessage = {“ “, “ “};
protected static String[ ] usageMessage = { “ “, “ “ };