4 ms·
Nice addon to Rust. Can this be implemented in rust itself, as part of the compilation ? For all the advanced features that current languages have in the compil
by iofj 11y ago
Nice addon to Rust. Can this be implemented in rust itself, as part of the compilation ? For all the advanced features that current languages have in the compiler for building and generating code, we have yet to see the first one that actually has a parser generator that's part of the program.
Parser combinators do this, but at runtime (and imho work better than parser generators). It would be nice to see if you could do compile-time parser combinators.
- killercup 11y ago> Can this be implemented in rust itself, as part of the compilation ? I'm not sure what you mean by 'in rust itself'. Do you mean as part of the rust compiler? It works fine as library. If I understand this [0] correctly, you add lalrpop to your build process and it then pre-compiles your `.lalrpop` files to rust code every time you build your project. So, it is part of the compilation even though it's not part of `rustc` itself. [0]: https://github.com/nikomatsakis/lalrpop/blob/master/doc/tutorial.md#adding-lalrpop https://github.com/nikomatsakis/lalrpop/blob/master/doc/tuto...
- iofj 11y agoI mean can the code generation be run as part of the rust compiler ? D seems to make this sort of thing possible using a number of methods including mixins [1]. [1] http://dlang.org/mixin.html http://dlang.org/mixin.html
- killercup 11y agorustc supports 'plugins' (like compile-time regex), but the interface is not declared stable.