From: ptkwt@... (Phil Tomson) Date: 2004-02-29T03:59:47+09:00 Subject: Re: Ruby Compiler [was Introducing myself and my interest in ruby] In article <40406832.1000009@ce.chalmers.se>, Robert Feldt wrote: >Mark wrote: > >> Mark Hubbart wrote: >> >>> >>> What are the chances of Cardinal having the ability to emit more than >>> one type of code structure for the tree it parses? Could it possibly >>> end up pluggable? >>> >>> >> It is my intention to do exactly this. >> >> The plan is to write a class that outputs the correct code structure >> and to pass an instance of that class into the compiler. >> >> This is necessary since at somepoint the intermediate compiler will be >> enhanced so that it can accept an abstract syntax tree and generate >> the parrot byte code from that. So at that point it will be very >> useful to be able to switch from outputting intermediate compiler code >> to just serialising the AST. >> >Concerning this and the discussion about what parser to use I'd say that >what we really need is to decide on a common AST representation for >Ruby. Then we can have different parser front-ends generating the >correct type of AST and have different analysis and code generation >back-ends. Yes, quite true. > >I'd say that in general though it's not the design of this or the >parsing that is the hard part; these things are pretty standard in >CS/compiler construction; the hard part is what kind of run-time support >is needed (and of course how you implement it) for Ruby semantics. Right, like how do you deal with eval - it should be doable in the runtime lib. > >BTW, I have two thesis students working (they'll be starting in 3 weeks >actually) on Ruby compilers, one for compiling to MSIL/CIL and one for >compiling to llvm. Would be great if all these different Ruby compiler >projects could eventually share code although I think it's too early for >that at this point... That's great we've got grad student slaves working on a Ruby compiler ;-) But seriously, this sounds like a great time to coordinate efforts. I'm not sure it's too early to do that. BTW: What's llvm? > >On Slang (Smalltalk subset used in Squeak) and related Ruby ideas you >might wanna check out >http://www.ce.chalmers.se/~feldt/ruby/ideas/rubyvm/ >and specifically >"SRuby - A Ruby dialect for low-level programming", >http://www.ce.chalmers.se/~feldt/ruby/ideas/rubyvm/sruby.pdf >might be a bit dated now but anyway. Yup, there's nothing new under the sun. Phil