yoav_lavi's comments

yoav_lavi | 3 years ago | on: AutoRegex

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!

yoav_lavi | 4 years ago | on: Babel Plugin Melody

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

yoav_lavi | 4 years ago | on: Melody – a language that compiles to regular expressions

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

yoav_lavi | 4 years ago | on: Melody – a language that compiles to regular expressions

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!

yoav_lavi | 4 years ago | on: Melody – a language that compiles to regular expressions

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)
page 1