I am in the process of writing a brainfsck interpreter. It's just a skeleton and I still have to add Ascii, multi-character, and loops but, I was wondering was their any way I could create a compiler with python? I heard I could use lex and yacc but I am still not sure how to use them or to actually compile the bf code. Any links, modules, comments, and help would be greatly apreciated.
-EAnder

If you want to use lex and yacc tools, I think you could start with PLY http://www.dabeaz.com/ply/, which is a pure python implementation of lex an yacc tools by David Beazley (the author of swig). I tried it, it works quite well. The difference with a C implementation is just execution speed, but as usual, after you've written your compiler, you can port the lex and yacc part to a C version if you like.

I suspect other compilers for brainfsck exist in python :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.