For the language pseudo (the one with gradual typing) I use a similar approach.
My compiler generates javac AST and then I call javac algorithms to generate bytecode. It takes me only one week to be able to compile the different versions of fibonacci. If I want to debug something in the compiler, instead of generating the bytecode, I use the pretty printer of javac which generates Java source. I choose this option because pseudo is almost a subset of Java + some dynamic magic, so generating a Java AST is not a limitation. For some constructs (involving closures/lambdas) of the pseudo language that doesn't exist in Java, I generate an invokokedynamic call to escape at runtime and provide the missing bits in the runtime of the language. Rémi Le 22/11/2009 22:05, John Wilson a écrit : > 2009/11/22 Matt Fowles<[email protected]>: > >> John~ >> >> You can easily get around the checked exceptions by just generating all your >> methods with 'throws Exception'. >> > Yes, but that makes it very messy if your users want to call your > methods from Java (lots of unnecessary try-catches). > > Sometimes you want to do things like generate synthetic methods which > you can't do at all in Java. > > John Wilson > > -- > > You received this message because you are subscribed to the Google Groups > "JVM Languages" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/jvm-languages?hl=. > > > -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=.
