Le 17/12/2009 17:42, Charles Oliver Nutter a écrit : > On Thu, Dec 17, 2009 at 8:58 AM, Matt Fowles<[email protected]> wrote: > >> I am interested in this technique, can you provide a pointer to some >> starting point where I can see how you do this? I thought javac didn't >> expose these classes. >> > Yeah, I'd like to hear more as well. I would use it in at least Duby's > JVM backend, and potentially for other things. I've hacked javac > internals, but never tried to feed it valid trees and make it spit out > bytecode. > > - Charlie >
Yes, I can :) Let me introduce Pseudo, a language that is a simpler C/Python. It's aim is to be used in first years of computer science to teach algorithmics. The cool feature of this language is gradual typing. Some samples are available here: https://code.google.com/p/pseudo-language/source/browse/trunk/pseudo/#pseudo/samples The grammar of the language is defined here: https://code.google.com/p/pseudo-language/source/browse/trunk/pseudo/compiler/pseudo.ebnf I use a parser generator that I've written with two friends, to generate the AST from the grammar. Here is an example of backend that takes an AST of Pseudo, convert it to a javac AST and run javac backend on the resulting tree: https://code.google.com/p/pseudo-language/source/browse/trunk/pseudo/compiler/src/com/googlecode/pseudo/compiler/gen/Gen.java PS: Gen is more complex than it could be because it generates invokedynamic call when it goes dynamic and tail call just for fun. cheers, Rémi -- 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=en.
