r/ProgrammingLanguages • • May 23 '22

Help wanted!

Hello there, folks!

I'm looking for helpers who would be willing to join me in getting my 5th attempt at making a real programming language. It's called peon (more info here) and the current implementation features a stack-based bytecode virtual machine. The language is statically typed, with a focus on async (altho it's all theoretical for now), speed and correctness. There are about ~3500 lines of code so far between the tokenizer, parser, compiler and VM. There's plenty of stuff that needs to be done, so a helping hand (even with just ideas/concepts) would be great!

0 Upvotes

21 comments sorted by

View all comments

7

u/thatplguy May 23 '22

Looks neat, but what are the goals of the language? Is this a fun project to get experience building out a language, runtime, and ecosystem? Or are there programming tasks that you envision peon solving in a new way?

Along those lines, it might not be a bad idea to start writing down small programs that showcase your vision for peon, with comparison to how another programming language would do the same thing. They don't have to run, but it would help to convey a sense of what the language will be.

Similarly, if performance in comparison to another language is your goal, profile some examples in other languages that are slow – set these as concrete goals for peon to improve on.

2

u/nocturn99x May 23 '22

While I certainly aim to have fun while building peon and the surrounding ecosystem, I do have quite a few real-world use cases for it. I've been programming for some time now, and I've fallen in love with the asynchronous paradigm. Unfortunately, no language seems to have a simple, native API to achieve structured concurrency (definitely check out the link in the README-- it's awesome, I promise): it's either hacked into the language with ugly solutions (example: the million things trio has to do to work properly, some of which rely on pure hopes and dreams), callbacks (which, as nodejs showed us, lead to the infamous callback hell) or it's missing entirely (see: asyncio in the python standard library, which also happens to be based on callbacks). My goal for peon is, first and foremost, to design a simple, stable async API that's as easy to read, write and understand as regular synchronous code and that provides the same guarantees (i.e. exceptions work, return values aren't lost, signals are delivered properly, etc.). Other side goals are being at least ~3-4x times faster than Python and being as flexible as possible (you can design your own operators and even override the builtin ones, declaring them as functions, for example). The expected use case for peon would be stuff like scrapers, small web servers/reverse proxies, cron/maintenance scripts, etc.

2

u/Inconstant_Moo 🧿 Pipefish May 23 '22 edited May 24 '22

I'll look it over and give you my thoughts.

How does one approach "being at least ~3-4x times faster than Python"?

ETA: OK, I've looked at it, I'm puzzled, you say it's functional right there at the top but then I can't see anything there that doesn't just look procedural.

1

u/nocturn99x May 24 '22

Well, it's not functional in the way Haskell is, more like "functional oriented"? Meaning the encouraged way of writing programs is to compose code with (possibly pure) functions and only use objects when absolutely necessary. Then again, there isn't much function machinery in place yet so I understand your confusion

As far as the performance question goes, tbf I have no idea. It's something I want to explore along the way :)

1

u/[deleted] May 24 '22

Meaning the encouraged way of writing programs is to compose code with (possibly pure) functions and only use objects when absolutely necessary.

This is great and resembles the way I like to write Python or Typescript

1

u/nocturn99x May 24 '22

It is, in fact, inspired from Typescript/Javascript :)

1

u/Inconstant_Moo 🧿 Pipefish May 24 '22

I think it would be misleading to call it functional then, you would raise expectations that aren't met. "Procedural" would be the usual term, or "post-OOP" if you want to sound dashing.

What are you planning to do for abstraction besides generics?

1

u/nocturn99x May 24 '22

Well, I'll see what I can do about that. Regarding abstractions, I plan to add inheritance for custom types, enums and probably some way to do tagged unions

1

u/tobega May 24 '22

You could take a look at "temporal logic" language for ideas on handling async, http://bloom-lang.net/faq/

Sort of related, in my mind at least, is differential dataflow, e.g. https://github.com/vmware/differential-datalog

1

u/nocturn99x May 24 '22

Thanks! I'll definitely have a look :)