News for hackers. Stuff that matters.

yoav_lavi

Re:Regex visualized as 3D marble run on Sunday October 18, 2026 @04:45PM (#50145311)
Melody (https://github.com/yoav-lavi/melody) is very similar in syntax to your example.

For example:

  <start>;
  
  option of "v";
  
  capture major {
    some of <digit>;
  }
  
  ".";
  
  capture minor {
    some of <digit>;
  }
  
  ".";
  
  capture patch {
    some of <digit>;
  }

  <end>;
Matches semver tags, e.g. v1.0.0
Re:AutoRegex on Saturday July 09, 2022 @12:27PM (#32036634)
I created Melody (https://github.com/yoav-lavi/melody) for the same reasons you've mentioned in the website. I knew AI would try to replace me one day, but I didn't think it'd be so soon.

Kidding of course, looks really cool!

Re:Babel Plugin Melody on Monday April 04, 2022 @01:07PM (#30909115)
Melody was posted here (not by myself), but the project was still in very early stages, and so I wanted to post an update that Melody now has:

- A Babel plugin - https://www.npmjs.com/package/babel-plugin-melody

- NodeJS bindings via WASM - https://www.npmjs.com/package/melodyc

- A playground - https://melody-playground.vercel.app/

- VSCode and JetBrains extensions - https://marketplace.visualstudio.com/items?itemName=yoavlavi... https://plugins.jetbrains.com/plugin/18693-melody

- A CLI and REPL

- A documentation book - https://yoav-lavi.github.io/melody/book/

The idea behind Melody is to represent regular expressions in a readable, maintainable format that plays nicely with larger projects, multiple people, diffs and so forth, while adding some QOL features.

See the repository here: https://github.com/yoav-lavi/melody

Melody – A readable language that compiles to regular expressions

Melody was posted here (not by myself), but the project was still in very early stages, and so I wanted to post an update that Melody now has:- A Babel plugin - https://www.npmjs.com/package/babel-plugin-melody- NodeJS bindings via WASM - https://www.npmjs.com/package/melodyc- A playground - https://melody-playground.vercel.app/- VSCode and JetBrains extensions -...

( Read More... | 3 comments | 5 points | on HN )
Re:Melody – a language that compiles to regular expressions on Friday February 18, 2022 @06:51AM (#30384576)
Thank you!

>If it could be done inline even better

I've been thinking of using a tagged template based mechanism (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) so no special editor support is needed and then transpile to a normal regex (similar to how htm handles it's syntax with no runtime, https://www.npmjs.com/package/babel-plugin-htm) but I'm not working on that part of the process yet so it may change.

If Melody does end up using the tagged template mechanism it may end up looking something like this:

  import melody from "melody";

  const batmanRegex = melody`
    16 of "na";

    2 of match {
      <space>;
      "batman";
    }
  `;
That would transpile to:

  const batmanRegex = /(?:na){16}(?:\sbatman){2}/;
Backticks would need escaping but otherwise it'd be normal Melody syntax
Re:Melody – a language that compiles to regular expressions on Thursday February 17, 2022 @04:32AM (#30371200)
Author here,

1. A reverse compiler is one of the 'maybe' features (see the table in the README), it's something I'd like but would essentially be an entire compiler so it's non trivial

2. The plan is to make Melody available as a compile step (like e.g. SASS) with no runtime overhead or as a Rust crate. You could do the compilation at runtime but other than including variables in the pattern I'm not sure if it'd have a benefit over compile time transforming, + it'd have a performance impact.

Thank you!

Re:Melody – a language that compiles to regular expressions on Wednesday February 16, 2022 @10:52AM (#30361573)
Author here, thank you! The reason I stated that Melody is unstable is that the project is very young (days) and so some of the syntax is still being considered and may change (although the general idea and direction will remain), and also not everything is implemented yet. I'm also considering changing the way the parsing works but that wouldn't affect end users in terms of expected results for valid code)
Re:Melody – a language that compiles to regular expressions on Wednesday February 16, 2022 @10:46AM (#30361483)
Author here, thanks for posting Melody! This is my first attempt at a language and I'm learning Rust, so any input would be appreciated