okp is a preprocessor for CPY and okp files that make C++ look more pythonic. After finding CPY, I realized that a language that looks like python but compiles like C++ could be very interesting. I really like the simplicity of python, but recognize that C++ has some of the best performance available.

CPY is written in C++ and has some strange keywords (like its IO shortcuts), that make it look a little too terse for my taste, so I implemented okp in python. The goal with okp is to write a pre-processor for .cpy and .okp files that can translate them into c++.

okp is mostly feature compatible with CPY except for project exporting, but all files that can compile in CPY are able to compile in okp.

My dream for okp is to use it as a language for solving problems in coding competitions and writing short programs in. It has the power and speed of C++ with the succinctness of python.

What’s okp look like?

def weird_multiply(int a, b):
    for i = 0; i < b; i++:
        a *= b
    return a

def main():
    int a, b
    read a, b

    print "WEIRD MULTIPLIED:", weird_multiply(a, b)


okp has a lot of sugar, including: function destructuring, whitespace based blocks, automatic variable declarations, automatic parenthesization of conditionals and more.


The difficult part of okp was creating a language that has feature parity with CPY, while still being legible.

Things I’ve written in okp

Further reading

While investigating CPY, I found multiple people have had the idea for a pre-processor that makes C++ looks more pythonic: