Thanks! The idea for using codecs is not mine - found it on StackOverflow somewhere. Googling for "how to add custom language statements python" should give you some results, this included :)
Also, in my case I had to use Codecs because a new operator causes AST-parser to not go through. But if you have some kind of syntax that will be compatible with Python AST, then you can implement it even easier.
You can google Python AST to get a lot of useful information :)