diff --git a/Coding-environment.md b/Coding-environment.md index 4fae4b2..acc4f33 100644 --- a/Coding-environment.md +++ b/Coding-environment.md @@ -97,4 +97,5 @@ The gist of the most significant argument for the upper version is that one read - If we decide to bite the bullet and implement our own unmangling, is Rust enough better than the far more mature C++ with vast legions of existing packages to make it worth doing this for Rust rather than C++? - There's at least one linear algebra library—[nalgebra](https://www.nalgebra.org/)—that's explicitly designed to support WASM builds. - Large, active, and growing user community. - - One way to build a syntax crufter/decrufter would be to have a parser that starts basically just like the Rust parser, and then modify it to accept the syntax we prefer. The official state of Rust grammar is sad, in that there was an accepted RFC#1331 to create an official grammar, which led to the grammar working group, which was disbanded in 2024 Apr. So it is not at all clear what the state is. On the other hand, there are at least three (lively) parsers out there other than the official rust compiler, namely rust-analyzer, which is the basis for the "official" Rust LSP used by VSCode etc; syn, a library within Rust used for writing macros; and the Intellij Rust plugin, which includes a BNF grammar for Rust (so possibly the best for our purposes?). I would likely start from one of these sources in trying to generate the parser for Crust (or whatever we'd call the decrufted Rust, maybe CLR -- the name of a popular rust remover ;-). \ No newline at end of file + - One way to build a syntax crufter/decrufter would be to have a parser that starts basically just like the Rust parser, and then modify it to accept the syntax we prefer. The official state of Rust grammar is sad, in that there was an accepted RFC#1331 to create an official grammar, which led to the grammar working group, which was disbanded in 2024 Apr. So it is not at all clear what the state is. On the other hand, there are at least three (lively) parsers out there other than the official rust compiler, namely rust-analyzer, which is the basis for the "official" Rust LSP used by VSCode etc; syn, a library within Rust used for writing macros; and the Intellij Rust plugin, which includes a BNF grammar for Rust (so possibly the best for our purposes?). I would likely start from one of these sources in trying to generate the parser for Crust (or whatever we'd call the decrufted Rust, maybe CLR -- the name of a popular rust remover ;-). + - Oh, actually, there is the [tree-sitter](https://tree-sitter.github.io/tree-sitter/) library which provides (incrementally-updatable!) parsers for a huge list of languages, including every language in this list on this wiki page except for Civet, Lobster, and F#. So I think if we want to do crufting/decrufting for any language that tree-sitter provides a grammar for, that's really the place to start. We can fold bits from the Nim or Python parsers into the Rust (or C++ even) parser, say, to get what we want. And it seems we can cache the parse of files to speed re-parsing when they change, which is a nice feature. \ No newline at end of file