#prog #parsing #rust #rustlib
Chumsky
A parser library for humans with powerful error recovery.
Пример парсера brainfuck:
Chumsky
A parser library for humans with powerful error recovery.
Пример парсера brainfuck:
use chumsky::prelude::*;
#[derive(Clone)]
enum Instr {
Left, Right,
Incr, Decr,
Read, Write,
Loop(Vec<Self>),
}
fn parser() -> impl Parser<char, Vec<Instr>, Error = Simple<char>> {
recursive(|bf| {
choice((
just('<').to(Instr::Left),
just('>').to(Instr::Right),
just('+').to(Instr::Incr),
just('-').to(Instr::Decr),
just(',').to(Instr::Read),
just('.').to(Instr::Write),
bf.delimited_by(just('['), just(']')).map(Instr::Loop),
))
.repeated()
})
}
GitHub
GitHub - zesterer/chumsky: Write expressive, high-performance parsers with ease.
Write expressive, high-performance parsers with ease. - zesterer/chumsky
🔥12
Блог*
#prog #parsing #rust #rustlib Chumsky A parser library for humans with powerful error recovery. Пример парсера brainfuck: use chumsky::prelude::*; #[derive(Clone)] enum Instr { Left, Right, Incr, Decr, Read, Write, Loop(Vec<Self>), } …
Пример сообщения о синтаксической ошибке для разрабатываемого этим же человеком своего языка программирования.
🤯30
#prog #regex #rust
Rustexp — A Rust regular expression editor & tester
В силу того, что используется скомпилированная в WASM библиотека regex (конкретно версии 1.3.9), поведение гарантированно то же, что и в ваших проектах.
Rustexp — A Rust regular expression editor & tester
В силу того, что используется скомпилированная в WASM библиотека regex (конкретно версии 1.3.9), поведение гарантированно то же, что и в ваших проектах.
rustexp.lpil.uk
A Rust regular expression editor & tester.
🔥6
#prog #rust прелесть какая
Suggest use .. to fill in the rest of the fields of Struct
Suggest use .. to fill in the rest of the fields of Struct
error: expected `..`, found `...`
--> $DIR/issue-102806.rs:11:26
|
LL | let _ = V3 { z: 0.0, ...v};
| ^^^
|
help: use `..` to fill in the rest of the fields
|
LL | let _ = V3 { z: 0.0, ..v};
| ~~
Интересно, что дифф для такого функционала совсем маленькийGitHub
Suggest use .. to fill in the rest of the fields of Struct by chenyukang · Pull Request #103012 · rust-lang/rust
Fixes #102806
👍2😁1
#prog #rust #amazingopensource
Cloning the Linux kernel in under a minute — именно такие результаты показывает gitoxide, клон git, написанный на Rust. Быстрее оригинального git, причём разрыв в скорости сохраняется и при сравнении работы на одном потоке.
Cloning the Linux kernel in under a minute — именно такие результаты показывает gitoxide, клон git, написанный на Rust. Быстрее оригинального git, причём разрыв в скорости сохраняется и при сравнении работы на одном потоке.
GitHub
Cloning the Linux kernel in under a minute · GitoxideLabs gitoxide · Discussion #579
Cloning the Linux kernel in under a minute TLDR Using gitoxide with default settings, we can now clone the linux kernel repository (receiving a pack, resolving it and a checkout of the working tree...
👍8❤4
#prog #rust #article
what if pointer properties were in the rust type system
...it's a type-system graph that allows you to at compile time prove that you can take a mutable pointer and dynamically degrade it to a const pointer and later re-upgrade it to mutable while completely disallowing upgrading const-only pointers to mutable
what if pointer properties were in the rust type system
...it's a type-system graph that allows you to at compile time prove that you can take a mutable pointer and dynamically degrade it to a const pointer and later re-upgrade it to mutable while completely disallowing upgrading const-only pointers to mutable
alex on cohost
what if pointer properties were in the rust type system
would that be fucked up or what
so as you may or mayn't know, i am the author of the funty [//crates.io/crates/funty] crate, which re-unifies all the primitives under a trait hierarchy so you can be generic over them, and i also experimentally am working…
so as you may or mayn't know, i am the author of the funty [//crates.io/crates/funty] crate, which re-unifies all the primitives under a trait hierarchy so you can be generic over them, and i also experimentally am working…
Forwarded from Врен о Японии для туриста
Вы не поверите, но это японский «Том и Джерри». Новую версию мультсериала нарисовали для локальной японской аудитории японцы же, добавили кавая, научили героев превращаться в конфетки и сладости…
Такое вот чудо дебютировало сегодня на японском Cartoon Network.
Такое вот чудо дебютировало сегодня на японском Cartoon Network.
🔥4🥰4👍2🤯2❤1
#rust
Если вы надумывали купить билет на Rustcon 2022 — сейчас самое время.
https://t.iss.one/rustcon_russia/1394
Если вы надумывали купить билет на Rustcon 2022 — сейчас самое время.
https://t.iss.one/rustcon_russia/1394
Telegram
RustCon - конференция по языку программирования Rust
С пятницей, друзья! Наступлению пятницы принято радоваться, ведь впереди выходные. Но сегодня у нас есть повод для веселья посолиднее.
11.11 стартует ЧЕРНАЯ ПЯТНИЦА! Теперь вы можете купить билеты на RustCon со скидкой 20% — как на офлайн, так и на онлайн…
11.11 стартует ЧЕРНАЯ ПЯТНИЦА! Теперь вы можете купить билеты на RustCon со скидкой 20% — как на офлайн, так и на онлайн…
😍1