0

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

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Gribouillis
0

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 :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.