Show HN: Lady Deirdre 2 – Rust Framework for Compilers and LSP Servers

github.com

141 points by Eliah_Lakhin 7 days ago

Greetings!

I would like to share with you my project, Lady Deirdre.

Lady Deirdre is a framework that helps you create new programming languages in Rust. It is specifically designed to develop compilers and interpreters with support for code editor extensions (LSP servers) from day one.

The framework includes essential components to design parsers and semantic analyzers capable of incrementally reparsing dynamically evolving source code.

Lady Deirdre can be seen as a replacement for preexisting projects with similar goals, such as Tree-Sitter, Rowan, or Salsa. However, Lady Deirdre aims to offer a unified framework API that guides you through the steps of programming language development, providing even more components necessary to develop a full-featured language ecosystem. For example, components to develop a source code formatter.

I will be happy to answer any questions.

Ilya

gsuuon 6 days ago

This is cool, I think an integrated compiler and LSP is a great standard for new languages. I'd go one further though and say that syntax highlighting should also be part of that language core. This way you have a single source of truth wrt to that language: how it should look, what it means and how it runs.

Tree-sitter is widely supported (both in editors and on web) for syntax highlighting as well as making semantic nodes available for external tools to interact with. Is there any chance you'd add a tree-sitter integration to this project? Or conversely, build out a compatible API that can be used with editors/tools that use tree-sitter's library?

The licensing is a bit confusing - for example, what happens with open-source projects that use this that are then used in commercial projects?

  • Eliah_Lakhin 6 days ago

    > build out a compatible API that can be used with editors/tools that use tree-sitter's library?

    That's an interesting idea. Tree-Sitter and Lady Deirdre are quite different in their approaches to parsing. Tree-Sitter is a GLR parser, while Lady Deirdre is a recursive-descent parser. In the Lady Deirdre API, there are customizable traits that let you define new types of files with parsers ("documents" in terms of Lady Deirdre). Perhaps it would be possible to create an adapter, but I would implement it as a separate crate.

    > what happens with open-source projects that use this that are then used in commercial projects?

    Good question. The idea is that if you link to Lady Deirdre in the Cargo.toml dependencies, it is up to the commercial project authors. They will compile the actual executable intended for selling by downloading both your crate and my crate. However, I'm not a lawyer, and this is not legal advice. Just my thoughts.

armchairhacker 7 days ago

First, I really like language frameworks like this. I think it could become very useful and popular.

That being said, I really doubt anyone will buy a commercial license. People don't sell compilers and IDEs, and the ones who do are large corporations who make everything themselves. Look at state of language tooling today: nearly every compiler is open-source, every language server is free, every IDE is free except JetBrains (a well-known company with a large reputation) and Sublime Text (being heavily replaced by VS Code), and anything not open-source has an active open-source alternative. Nobody's going to buy a license from you to sell their compiler, because nobody's planning to sell their compiler.

For this reason I'd recommend changing the license. I don't think it's overly-restrictive or dishonest, I think it's fair to expect being paid if someone makes >$200,000 off your work. But nonetheless it hurts adoption, a lot of people will see "proprietary" and not even read the license text. You're more likely to make money distributing it as MIT / Apache, letting it get popular, and setting up donations/sponsorships to fund development. But honestly, if you're looking to make money this isn't the space to do so: you could be hired by someone to work on PL, or you could sell something like a game, but you're not going to sell your own PL.

  • Eliah_Lakhin 7 days ago

    Thank you for your feedback!

    I agree with your point about the licensing. I would also add that tools for the development of compiler front-ends are quite a niche market. So, honestly speaking, I don't plan to earn much from my project regardless of the license terms. This work is part of a higher-level in-progress toolset, which is closer to the end users. I have dedicated it as a separate project primarily for public preview, with some restrictions on distribution and use, as I haven't decided on the overall toolset distribution model yet. But it is possible that I will change the licensing terms of Lady Deirdre in the future to something less restrictive (maybe even MIT) to make it more popular, this is just not my current goal. I apologize for any inconvenience my current licensing terms may cause.

    • zackbrown 7 days ago

      > I apologize for any inconvenience my current licensing terms may cause.

      Friendly advice from a stranger, worth what it costs: I believe the greatest inconvenience of a commercial license will be to _you_, as opposed to end-users.

      The market is so saturated with open source, developers expect it, and commercial licenses cause huge usage friction and doubt.

      The "dual license" died as a viable business model around the time Meta (née Facebook) and Microsoft starting investing billions into free-as-in-beer OSS, 10-15 years ago.

      Today, this model will only sabotage usage. People using your OSS is good. Even if your goal isn't to become popular, usage & feedback are learning, and while it's fine for popularity not to be a goal, I would encourage you not to proactively target the opposite of popularity.

      If you have some other IP (the other tech you're describing) that can remain proprietary or wrapped behind a service, then people using other pieces of your stack for free is a _really good thing._ At least, they're aware of your brand and have started to trust it. At best, they're ready to use your commercial offering out of the gate.

    • Onavo 7 days ago

      You could however offer a cloud based static analysis API for security companies, which could be a viable source of revenue to fund the development.

    • zamalek 6 days ago

      IANAL/IANYL. Make it dual-licensed, AGPL with MIT by request. Indicate that you are presently declining MIT license requests. The chances of your agreement being adhered to are near zero, regardless of the legality. On the other hand, any mention of GPL will send lawyers running for the hills - AGPL more-so (and legally so, it makes your code basically useless to a corp). The MIT carveout is merely there so that contributors don't throw a fit if you choose a more permissive license down the line.

  • giancarlostoro 7 days ago

    It's 5 thousand after you've made 200 thousand though? I think that's the only restriction? Unless he updated it before I got to look.

    • Eliah_Lakhin 6 days ago

      > It's 5 thousand after you've made 200 thousand though?

      That's correct. The license agreement requires purchasing a commercial license per product if it reaches a certain revenue threshold. I believe this price should be feasible for a business, and this restriction is not unfair for regular programmers either. To clarify, the license needs to be renewed annually to continue receiving new versions from me. Additionally, I reserve the right to change the price in the future. However, license renewal is not a strict obligation. You can continue using the previous versions if you buy the license at least once.

      The idea is to replace the donation model widespread in typical OSS projects with a formal obligation to purchase a license. I believe this approach more accurately expresses what the authors really want in exchange for their labor.

      • Vegenoid 6 days ago

        I think your approach is good. There are several ways to make money by independently making software:

        1. Charge money for the software

        2. Charge money to help people implement/use the software

        3. Leverage the experience and credibility gained to get a company to hire you or sell consulting services

        4. Hope that people give you money for the software out of the goodness of their heart

        Opting for an MIT license pretty much ensures that the software will only make money for you indirectly via option 3, and maybe you'll get a trickle via option 4. There are numerous examples of people making popular OSS that become frustrated with companies that are using their software to make money, and they aren't getting anything for it. They have to work for other people for money despite having made software that generates lots of value. If you want to ensure that if your software creates substantial value, you get some of it, you need a license like yours.

        I think there is a strong argument that if you want to get paid for your software, you simply shouldn't make it any flavor of source-available. A company may actually be more willing to buy software that is closed source than open source, because the closed-source software is simply perceived as being more valuable. Of course, as an engineer, I love that the source code is available.

  • prmph 6 days ago

    Yeah the readme claims you can use this in an open source project. This is weird. An open source project that bundles this software (as a language implementation necessarily must) will _not_ remain open source. The only way a related work remains open source is if it depends on this project as a _peer_ dependency.

    So as it is, I seriously doubt that anyone wanting a quicker way to implement a language will use this; why would I want to hamper adoption of my language by hobbling it with such a license?

solarpunk 7 days ago

I like the Alpha Centauri reference here lol.

  • WJW 6 days ago

    I was just thinking about that haha. I'd think she's kinda the opposite of a rust lover though.

    (did you know the game + expansion are available for 4.99 on Steam and it runs out of the box on linux? Just saying)

mdaniel 7 days ago

The way the headline was written it seemed like this was the second iteration of Lady and not just a 2.0 release announcement

It would have also gone a long way if you had mentioned the licensing, which I am always interested in: https://github.com/Eliah-Lakhin/lady-deirdre#copyright

As for a question: why the seemingly needless location of everything down in a "work" folder? Is there something else that you envision one day living at the top-level which you just planned for by putting everything someone would care about one further click away?

  • Eliah_Lakhin 7 days ago

    You are right, this is indeed the second iteration of the project. Since the first iteration (released about a year ago), many things have changed and been reworked. The most notable change is the introduction of the semantic-analysis framework. Lady Deirdre 1 was merely an incremental parser library.

    > why the seemingly needless location of everything down in a "work" folder?

    It's just easier for me to organize the filesystem this way on my local machine. Everything that is unrelated to the development is outside of the work directory. Also, the license agreement refers to the "work". Perhaps it would be clearer for users if the work directory is clearly dedicated.

    > Is there something else that you envision one day living at the top-level which you just planned for by putting everything someone would care about one further click away?

    Everything that I planned to publish that is related to Lady Deirdre is already in the repository. I use this project for my other programming language project that I plan to release soon, but it will be in a separate GitHub repo. Actually, Lady Deirdre initially was separated from the language project codebase as I thought it may be useful for other programming language authors.

weinzierl 7 days ago

"replacement for preexisting projects with similar goals, such as Tree-Sitter, Rowan, or Salsa."

To be a true replacement, there is at least one crucial feature missing: A LICENSE file that starts with "The MIT License (MIT)".

Nothing against "source available" but thinking to have a chance to stand in for more permissively licensed projects is very much unrealistic.

  • vlovich123 7 days ago

    It’s amusing to me that we as a community both complain that OSS maintainers aren’t paid and then expect someone who’s making the source available to pick OSS. Let people try alternate funding models and honestly as a hacker community we should be a bit more supportive of the work required to bootstrap something.

    • vendiddy 6 days ago

      Yeah I would like to see more ideas like this.

      I really hope there's a model out there for OSS at least where folks can get paid.

      I always wondered what if engineers had a $100/month budget to donate to OSS founders. It wouldn't cost an employer much and would be a good way to give back.

      • hzakr 6 days ago

        Yeah I would like to see more ideas like this.

        I really hope there's a model out there for OSS at least where folks can get paid.

        I always wondered what if engineers had a $100/month budget to donate to OSS founders. It wouldn't cost an employer much and would be a good way to give back.

  • eqvinox 6 days ago

    > there is at least one crucial feature missing: A LICENSE file that starts with "The MIT License (MIT)".

    How much, monetarily, would you be willing to contribute to implement that feature?

    • weinzierl 6 days ago

      Nothing, and that is exactly my point. I have nothing against monetization at all.

      What I am saying is, that if the elevator pitch for the project you are trying to monetize is "this is a replacement for $MIT-LICENSED-PROJECT" you will have a hard time.

      The question the elevator pitch should answer first is how much this brings to the table to make me consider paying instead of just using the permissively licensed project for free.

      • jenadine 2 days ago

        But it is a replacement. One project don't need to be a pareto obtimum to claim to be replacement, it's ok even if there are some drawbacks.

        Having to pay is clearly one drawback for some, but if you save this money by not having to develop some features or getting some support, then it may be worth it.

mtndew4brkfst 6 days ago

Thank you to the commenters who highlighted the licensing. I would ordinarily be very interested in this premise but I don't want to risk unconsciously adapting ideas from what I read that could put me in tension with the terms or the author, and I can't use it directly.

  • williamcotton 6 days ago

    Are you worried about copyright infringement?

    • mtndew4brkfst 6 days ago

      I'm basically trying to avoid situations where I might be legally obligated to prove a negative, that I did not take ideas or code from a proprietary yet source-available project that is topically very adjacent to some projects I work on. I write with Rust, use Rowan and tree-sitter crates, create LSP implementation, and so on.

      I don't have a retained lawyer or legal budget, so it's just risk aversion on my part to treat this project as radioactive and never once look inside. Same reason a lot of folks don't look at GPL'd things.

      • williamcotton 6 days ago

        The burden of proof is on the accuser so you never need to worry about proving a negative.

        Unless there are patents involved, and we’re just talking about possible copyright infringement, then you’re free to borrow the ideas just not the expressions. Which in practice means if you’re not blatantly copying then the proof of Structure, Similarity and Organization is prohibitively expense for the plaintiff.

samatman 7 days ago

[flagged]

  • itishappy 7 days ago

    The readme does not claim to be open source.

    > This work is proprietary software with source-available code.

    > To copy, use, distribute, and contribute to this work, you must agree to the terms and conditions of the General License Agreement.

    It's pretty clear on the rights granted:

    > Please be aware that my work is proprietary software, intended for solo development. For this reason, the agreement requires you to automatically assign me the changes you make to my project's source code.

    > However, if you want to create an extension for my crate, you can develop a separate crate that uses my crate's public APIs through Cargo. In this case, you don't have to assign me your work, and you can distribute your project under any permissive license, such as the MIT license.

    These quotes are all pulled from the readme, and the last edit was 5 hours before your comment. Where's the lie?

    • samatman 7 days ago

      What I quoted is also from the README. You cannot use proprietary code in an open source project, and the README says you can. That is fundamentally dishonest. The sum of MIT licensed code which requires linking to proprietary code to function is not an open source project. It is a proprietary project with an open-source part. You cannot use this in an open source project. Period.

      Making that section of the FAQ honest would look like this:

      > Can I use Lady Diedre in an Open Source project?

      > No. Lady Diedre is not available via an open source license.

      > Can I use it in a noncommercial publicly-available project?

      > For now. The EULA clearly reserves my right to change the terms at any time, so if that risk is acceptable to you, you have my temporary permission to do so, subject to revocation at any time and without notice.

      • itishappy 7 days ago

        > The sum of MIT licensed code which requires linking to proprietary code to function is not an open source project.

        I don't think that's true or nothing compiled using MSVC could ever be open source. For example: Rust.

        > For now. The EULA clearly reserves my right to change the terms at any time, so if that risk is acceptable to you, you have my temporary permission to do so, subject to revocation at any time and without notice.

        Terms can be changed at any time, but you do not have to accept them. From the EULA:

        > You are not obligated to accept any new terms or amendments. In such a case, this Agreement will continue to govern your use of the Work you have already accessed under the original terms. However, if you do not accept the new terms or amendments, you will not be permitted to use any new versions, updates, upgrades, or modifications to the Work.

        • samatman 6 days ago

          > I don't think that's true or nothing compiled using MSVC could ever be open source. For example: Rust

          It is true. Rust does not require MSVC in order to compile. Also, linking to proprietary code, and compiling code using a proprietary binary, are completely different things. A distribution of Rust which contained a proprietary library would not be open source, but that's entirely allowed, because Rust's license isn't viral.

          As it happens, the linkable portion of MSVC is Apache 2.0:

          https://devblogs.microsoft.com/cppblog/open-sourcing-msvcs-s....

          This is so that open-source software which requires MSVC framework remains open source.

          Please see this classic thread for more details:

          https://gitlab.com/gnu-clisp/clisp/-/blob/master/doc/Why-CLI...

          I'm not opposed to proprietary software, and as long as people clearly understand what they're getting into, they should make their own choices about using Lady Diedre. But the FAQ is dishonest, and I have a problem with that.

          > You are not obligated to accept any new terms or amendments. In such a case, this Agreement will continue to govern your use of the Work you have already accessed under the original terms. However, if you do not accept the new terms or amendments, you will not be permitted to use any new versions, updates, upgrades, or modifications to the Work.

          Great. Be sure to pin the cargo version of your proprietary-by-inclusion otherwise-MIT not-open-source project to the current version, because otherwise you might link an update without checking the EULA, and now you can be sued over it.

          • itishappy 6 days ago

            These concerns apply to viral licenses like the GPL, not permissive such as MIT. Also, they only apply if you modify or distribute the software, which does not include running `cargo add lady-deirdre`. This is pointed out in the README and again in the EULA:

            > However, if you want to create an extension for my crate, you can develop a separate crate that uses my crate's public APIs through Cargo. In this case, you don't have to assign me your work, and you can distribute your project under any permissive license, such as the MIT license.

            > For the purposes of this Agreement, third-party works that remain separable from the Work, that use the application programming interfaces (APIs) of the Work only, and that do not copy, distribute, display, or sell the Work or any part of the Work to third parties in source or compiled form, shall not be considered "Derivative Work."

            I am not a lawyer so I reached out to one about this particular repository. She says you'd be fine using the MIT license for your code. (I'd still talk to your own lawyer first if you're uncomfortable.)

            > Be sure to pin the cargo version of your proprietary-by-inclusion otherwise-MIT not-open-source project to the current version

            If you don't want to call MIT-licensed code open-source, that's an interesting argument, but not one I view it's fair to accuse the developer of lying over.

            • samatman 5 days ago

              You're reading the virality backward. As I said, the MIT licensed part of the code remains MIT licensed. But the project is not an open source project.

              There's lots of MIT licensed code in proprietary software, it's one of the things that the license allows. Similarly, a GPL licensed project can always include any amount of MIT, because one of the things you can do with MIT code is relicense it as GPL: the original license still applies, but the whole project is now GPL.

              But a project which cannot even compile without a proprietary library is a proprietary project. Not an open-source one. macOS is a proprietary operating system with many open source components. A language using Lady Diedre would be no different.

            • prmph 6 days ago

              I agree with samatman. In what way can a work that has a proprietary work bundled in be called open source? It is different if the the work has a _peer_ dependency on the proprietary work.

              As it is, I seriously doubt that anyone wanting a quicker way to implement a language will use this; why would I want to hamper adoption of my language by hobbling it with such a license?

      • tazjin 6 days ago

        > You cannot use proprietary code in an open source project, and the README says you can. That is fundamentally dishonest.

        That doesn't make any sense. There's plenty of open-source Windows/Mac apps, but they don't give you access to Windows/Mac OS itself.

        • prmph 6 days ago

          You're misunderstanding the point made. Open source Windows and Mac apps do not _bundle_ Windows or Mac.

          To understand the argument, consider the difference between a runtime dependency and a peer dependency in Node.js.