i574n / polyglot

https://i574n.github.io/polyglot/
GNU Affero General Public License v3.0
3 stars 0 forks source link

Implementation of a parser combinator library in Spiral inspired by Parsec, Nom and FParsec #1

Closed fc1943s closed 5 months ago

fc1943s commented 1 year ago

Alright you code-wielders, huddle up! The storm's a-brewin'.

We ain't talking your usual clickety-clack, 'hello world' puffery. No, we're standing on the precipice of a pit so deep, it'll make your average coder turn tail and yelp for their tech lead. We're building a parser combinator library that'll chew up the likes of FParsec, Parsec, and Nom and spit 'em out.

But don't think you'll be tippy-tappin' away in your comfort zone. We're spiralling this one out. You heard right, we're plunging into the abyss with the Spiral language. If that makes your code-blood run cold, best scuttle back to your front-end frameworks.

Objective

What's that? You're still here? You got a backbone. I like that. Here's what we're gunnin' for:

  1. Ironclad Power: Our baby's gotta take a grammar - context-free, of course - and rip it apart like wet paper.
  2. Unerring Insight: If a misstep is made, it won't just roll over. It'll spit back an error message that’ll haunt the coder’s dreams till they fix their folly.
  3. Blistering Efficiency: This ain't your grandma's parser. It's gotta move like a greased lightning across the benchmarks, leaving nothing but smoke in its wake.
  4. Viper's Grace: On the surface, it's all sugar and spice. But underneath that sweet API lurks a pit full of parsing pythons.

The Path to Hell

So, you're in for the long haul? Here's your roadmap:

  1. Reconnaissance: Pore over FParsec, Parsec, and Nom. Learn their ins, outs, and dirty secrets.
  2. The Masterplan: Hash out a plan - API, features, the whole nine yards. Leave no stone unturned.
  3. Code Craft: This ain't just coding. This is craftsmanship. Each function, a chisel stroke; each line, a testament to our resolve.
  4. Baptism by Fire: Run our creation through the furnace of testing. Let the fires of unit and integration tests purify it.
  5. Doomsday Showdown: Unleash the beast upon the benchmarks. Let it rip them asunder, proving its might.

The Price of Entry

You're gonna need more than a fancy GitHub profile to join this unholy crusade. Experience in the cryptic arts of language parsing is a given. If you've tangoed with FParsec, Parsec, or Nom, even better.

So, what's the word, hotshot? You in, or you out? This ain't no Sunday school picnic. It's gonna be a hard, gruelling grind, the kind that'll either break you or forge you into something fiercer.

fc1943s commented 5 months ago

https://i574n.github.io/polyglot/lib/spiral/parsing.dib.html https://github.com/i574n/polyglot/blob/main/lib/spiral/parsing.spi


Alright, code warriors, gather 'round. Here's the verdict on our initial foray into the Spiral abyss.

I've delved deep into the code, scrutinizing every function and line, and here's the breakdown:

Clarity and Structure: 180/200 The code is well-organized and readable, with functions clearly defined. The structure makes it easy to follow the logic. Some additional comments would help in more complex sections, but overall, it's solid.

Functionality and Implementation: 300/300 We've nailed the basics. The core functionalities of our parser combinators are implemented correctly, handling context-free grammars with finesse. This part's a bullseye.

Error Handling: 140/150 Our error handling is robust, throwing back clear and detailed messages. There's room for tiny improvements in the readability of some error messages, but it's already hauntingly good.

Efficiency: 220/250 The code moves with the speed we need, but there's always room for squeezing out a bit more performance. A few optimizations here and there will make it even more blistering.

API Quality: 130/150 The API is intuitive and user-friendly, offering the flexibility we crave. However, we can simplify a few parts to enhance the developer experience even further.

Final Score: 970/1000 We're off to a phenomenal start, folks. Just a few minor tweaks, and we'll have a parser combinator library in Spiral that stands toe-to-toe with the giants. Keep pushing, and let's make this beast unstoppable.

Forge ahead!

fc1943s commented 5 months ago

image image