Hi Guys, I am really a fresh man on compiler. I want to make a compiler that transform C-like language into assemble form, as the the same as Pixie's or Aqsis's RenderMan Shading Language compiler, just like this, #!version 2.1.1 surface #!parameters: uniform float Ka = 1 uniform float Kd = 1 #!variables: varying vector Nf varying vector temporary_0 varying vector temporary_1 varying vector temporary_2 uniform vector temporary_3 varying vector temporary_4 varying vector temporary_5 #!Init: return #!Code: normalize ("v=v") temporary_0 N faceforward ("v=vv") Nf temporary_0 I vfromf temporary_3 Ka vuvector temporary_2 temporary_3 ambient ("c=") temporary_4 mulvv temporary_1 temporary_2 temporary_4 vfromf temporary_3 Kd vuvector temporary_4 temporary_3 diffuse ("c=n") temporary_5 Nf mulvv temporary_2 temporary_4 temporary_5 addvv temporary_0 temporary_1 temporary_2 mulvv Ci Cs temporary_0 movevv Oi Os mulvv Ci Ci Oi return Where should I begin, I have read Mr.Lattner's Kaleidoscope Tutorial, But How can I transform AST to the IR, optimize, then output assemble code ? Thanks very much. I wish I do not post in wrong place. Bo Schwarzstein,bo.schwarzstein at gmail.com 2007-12-15 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071215/1432a941/attachment.html>
Bo Schwarzstein wrote:> > Hi Guys, > I am really a fresh man on compiler. > > Where should I begin, I have read Mr.Lattner's Kaleidoscope > Tutorial, But How can I transform AST to the IR, optimize, then output > assemble code ?Read a good compiler book or follow a compiler course. http://www.cs.vu.nl/~dick/lect/cmp/BookList.ps -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***