DEV Community

Cover image for P++: A Language That Speaks Both Interpreter and Compiler
teejayRedex
teejayRedex

Posted on

P++: A Language That Speaks Both Interpreter and Compiler

What if your language could prototype like Python, but run like C?

That’s the goal behind P++, a new experimental programming language I’ve been building from the ground up. With P++, developers don’t have to choose between ease of use and performance. You get both:

🌟 Key Features:

  • 🧠 Interpreter Mode for fast iteration and debugging
  • ⚙️ LLVM Compiler Mode for JIT/AOT execution and performance
  • 🧪 A new REPL shell where you can write and run P++ line by line
  • 📦 Simple syntax, extensible architecture (custom IR, LLVM backend)

Why P++?

Languages like Python make it easy to build ideas quickly, but struggle with speed. Languages like C++ give you power—but come with more complexity and compile times. P++ is designed to bridge that gap.

Switch between interpreted and compiled modes on the fly. Write something, test it, then turbocharge it when you're ready.

What It Looks Like:

num as int32 = 42
ptr as *int32 = &num

def square(val as int32) -> int32:
    return val * val

class Box<DataType>:
    value as DataType

    def __init__(v as DataType):
        self.value = v

    def get() -> DataType:
        return self.value

# Using inline assembly
def add_asm(a as int32, b as int32) -> int32:
    asm {
        "mov eax, a"
        "add eax, b"
        "ret"
    }

arr as *int32 = malloc(int32, 5)
*arr = 99
free(arr)

Enter fullscreen mode Exit fullscreen mode

In interpreter mode, it's instant. In compiler mode, it’s JIT-ed and executed using LLVM.

I’m Inviting You

This is still in early development. I’m putting it out there to get feedback, suggestions, and collaborators. Whether you're into language design, compiler theory, or just curious about new tech, I’d love your take.

👉 Check out the repo. Share your thoughts. Let’s build something together.

Would you use a language like P++? What features would you want?


Top comments (0)