News for hackers. Stuff that matters.
Re:Writing a compiler in Python using Lex, Yacc and LLVM by sketerpot on Saturday September 19, 2009 @11:16PM (#832655)
Inspired by this, I've started writing a compiler for a subset of Matlab. I'm sick of Matlab being an interpreted language year after year, and while I don't hope to change that, I can at least do a proof-of-concept to lend weight to my derision.

I've got the lexer and parser done, thanks to Parsec, and some basic C code generation as a sanity check. Now for the runtime LLVM code generation, to make it feel like an interpreter! Thanks, HN!

Re:Writing a compiler in Python using Lex, Yacc and LLVM by maximilian on Sunday September 20, 2009 @01:02AM (#832742)
I've been fooling around with this idea for a good year now. I've never found the time, but I think about doing something like it all the time. If I come across free time after my thesis, I hope to write a simple typed matlab-like clone that targets llvm code (which supports vectors). To me it seems that there is a vacuum for a simple typed fast numerics language with native vector support. Writing numerics in Matlab is great, but if you ever have to loop, it ends up dog slow. Porting the code to C is usually not terribly difficult, but is always a big pain, but usually yields a factor 10x or more speedup which is pretty significant. It would seem that applied mathematicians and physicists around the world would love a new, modern and fast numerics language to replace coding in C/C++/Fortran.
Re:Writing a compiler in Python using Lex, Yacc and LLVM by ilkhd2 on Sunday September 20, 2009 @02:39AM (#832822)
Probably frontend can be taken from GNU Octave? Claims to be similar to Matlab...
Re:Writing a compiler in Python using Lex, Yacc and LLVM by maximilian on Sunday September 20, 2009 @01:08AM (#832750)
Could you post a link to Parsec. Quick googling didn't come up with any compiler tools. Thanks!
Re:Writing a compiler in Python using Lex, Yacc and LLVM by GeoJawDguJin on Sunday September 20, 2009 @02:32AM (#832813)
It's a Haskell library: http://hackage.haskell.org/package/parsec

Here's a tutorial that uses it to parse a simplified Scheme: http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_H...

Re:Writing a compiler in Python using Lex, Yacc and LLVM by anatoly on Sunday September 20, 2009 @02:29AM (#832807)