brainfuck interpreter
brainfuck cli rust
5

Configure Feed

Select the types of activity you want to include in your feed.

parser: implemented source code snippets, enabled fancy printing

digi.rip (Jun 9, 2026, 2:14 PM EDT) c4a883fb e0388c7c

+212 -7
+190 -1
Cargo.lock
··· 3 3 version = 4 4 4 5 5 [[package]] 6 + name = "addr2line" 7 + version = "0.25.1" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" 10 + dependencies = [ 11 + "gimli", 12 + ] 13 + 14 + [[package]] 15 + name = "adler2" 16 + version = "2.0.1" 17 + source = "registry+https://github.com/rust-lang/crates.io-index" 18 + checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" 19 + 20 + [[package]] 6 21 name = "anstream" 7 22 version = "1.0.0" 8 23 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 53 68 ] 54 69 55 70 [[package]] 71 + name = "backtrace" 72 + version = "0.3.76" 73 + source = "registry+https://github.com/rust-lang/crates.io-index" 74 + checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" 75 + dependencies = [ 76 + "addr2line", 77 + "cfg-if", 78 + "libc", 79 + "miniz_oxide", 80 + "object", 81 + "rustc-demangle", 82 + "windows-link", 83 + ] 84 + 85 + [[package]] 86 + name = "backtrace-ext" 87 + version = "0.2.1" 88 + source = "registry+https://github.com/rust-lang/crates.io-index" 89 + checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" 90 + dependencies = [ 91 + "backtrace", 92 + ] 93 + 94 + [[package]] 95 + name = "bitflags" 96 + version = "2.11.1" 97 + source = "registry+https://github.com/rust-lang/crates.io-index" 98 + checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" 99 + 100 + [[package]] 56 101 name = "cfg-if" 57 102 version = "1.0.4" 58 103 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 105 150 checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" 106 151 107 152 [[package]] 153 + name = "errno" 154 + version = "0.3.14" 155 + source = "registry+https://github.com/rust-lang/crates.io-index" 156 + checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" 157 + dependencies = [ 158 + "libc", 159 + "windows-sys", 160 + ] 161 + 162 + [[package]] 163 + name = "gimli" 164 + version = "0.32.3" 165 + source = "registry+https://github.com/rust-lang/crates.io-index" 166 + checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" 167 + 168 + [[package]] 108 169 name = "heck" 109 170 version = "0.5.0" 110 171 source = "registry+https://github.com/rust-lang/crates.io-index" 111 172 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 112 173 113 174 [[package]] 175 + name = "is_ci" 176 + version = "1.2.0" 177 + source = "registry+https://github.com/rust-lang/crates.io-index" 178 + checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" 179 + 180 + [[package]] 114 181 name = "is_terminal_polyfill" 115 182 version = "1.70.2" 116 183 source = "registry+https://github.com/rust-lang/crates.io-index" 117 184 checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" 118 185 119 186 [[package]] 187 + name = "libc" 188 + version = "0.2.186" 189 + source = "registry+https://github.com/rust-lang/crates.io-index" 190 + checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" 191 + 192 + [[package]] 193 + name = "linux-raw-sys" 194 + version = "0.12.1" 195 + source = "registry+https://github.com/rust-lang/crates.io-index" 196 + checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" 197 + 198 + [[package]] 199 + name = "memchr" 200 + version = "2.8.1" 201 + source = "registry+https://github.com/rust-lang/crates.io-index" 202 + checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" 203 + 204 + [[package]] 120 205 name = "miette" 121 206 version = "7.6.0" 122 207 source = "registry+https://github.com/rust-lang/crates.io-index" 123 208 checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" 124 209 dependencies = [ 210 + "backtrace", 211 + "backtrace-ext", 125 212 "cfg-if", 126 213 "miette-derive", 127 - "unicode-width", 214 + "owo-colors", 215 + "supports-color", 216 + "supports-hyperlinks", 217 + "supports-unicode", 218 + "terminal_size", 219 + "textwrap", 220 + "unicode-width 0.1.14", 128 221 ] 129 222 130 223 [[package]] ··· 139 232 ] 140 233 141 234 [[package]] 235 + name = "miniz_oxide" 236 + version = "0.8.9" 237 + source = "registry+https://github.com/rust-lang/crates.io-index" 238 + checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" 239 + dependencies = [ 240 + "adler2", 241 + ] 242 + 243 + [[package]] 244 + name = "object" 245 + version = "0.37.3" 246 + source = "registry+https://github.com/rust-lang/crates.io-index" 247 + checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" 248 + dependencies = [ 249 + "memchr", 250 + ] 251 + 252 + [[package]] 142 253 name = "once_cell_polyfill" 143 254 version = "1.70.2" 144 255 source = "registry+https://github.com/rust-lang/crates.io-index" 145 256 checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" 257 + 258 + [[package]] 259 + name = "owo-colors" 260 + version = "4.3.0" 261 + source = "registry+https://github.com/rust-lang/crates.io-index" 262 + checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d" 146 263 147 264 [[package]] 148 265 name = "proc-macro2" ··· 163 280 ] 164 281 165 282 [[package]] 283 + name = "rustc-demangle" 284 + version = "0.1.27" 285 + source = "registry+https://github.com/rust-lang/crates.io-index" 286 + checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" 287 + 288 + [[package]] 289 + name = "rustix" 290 + version = "1.1.4" 291 + source = "registry+https://github.com/rust-lang/crates.io-index" 292 + checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" 293 + dependencies = [ 294 + "bitflags", 295 + "errno", 296 + "libc", 297 + "linux-raw-sys", 298 + "windows-sys", 299 + ] 300 + 301 + [[package]] 166 302 name = "strsim" 167 303 version = "0.11.1" 168 304 source = "registry+https://github.com/rust-lang/crates.io-index" 169 305 checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 170 306 171 307 [[package]] 308 + name = "supports-color" 309 + version = "3.0.2" 310 + source = "registry+https://github.com/rust-lang/crates.io-index" 311 + checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" 312 + dependencies = [ 313 + "is_ci", 314 + ] 315 + 316 + [[package]] 317 + name = "supports-hyperlinks" 318 + version = "3.2.0" 319 + source = "registry+https://github.com/rust-lang/crates.io-index" 320 + checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" 321 + 322 + [[package]] 323 + name = "supports-unicode" 324 + version = "3.0.0" 325 + source = "registry+https://github.com/rust-lang/crates.io-index" 326 + checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" 327 + 328 + [[package]] 172 329 name = "syn" 173 330 version = "2.0.117" 174 331 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 188 345 ] 189 346 190 347 [[package]] 348 + name = "terminal_size" 349 + version = "0.4.4" 350 + source = "registry+https://github.com/rust-lang/crates.io-index" 351 + checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" 352 + dependencies = [ 353 + "rustix", 354 + "windows-sys", 355 + ] 356 + 357 + [[package]] 358 + name = "textwrap" 359 + version = "0.16.2" 360 + source = "registry+https://github.com/rust-lang/crates.io-index" 361 + checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" 362 + dependencies = [ 363 + "unicode-linebreak", 364 + "unicode-width 0.2.2", 365 + ] 366 + 367 + [[package]] 191 368 name = "unicode-ident" 192 369 version = "1.0.24" 193 370 source = "registry+https://github.com/rust-lang/crates.io-index" 194 371 checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" 195 372 196 373 [[package]] 374 + name = "unicode-linebreak" 375 + version = "0.1.5" 376 + source = "registry+https://github.com/rust-lang/crates.io-index" 377 + checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" 378 + 379 + [[package]] 197 380 name = "unicode-width" 198 381 version = "0.1.14" 199 382 source = "registry+https://github.com/rust-lang/crates.io-index" 200 383 checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 384 + 385 + [[package]] 386 + name = "unicode-width" 387 + version = "0.2.2" 388 + source = "registry+https://github.com/rust-lang/crates.io-index" 389 + checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" 201 390 202 391 [[package]] 203 392 name = "utf8parse"
+1 -1
Cargo.toml
··· 6 6 7 7 [dependencies] 8 8 clap = { version = "4.6.1", features = ["derive"] } 9 - miette = { version = "7.6.0", features = ["derive"] } 9 + miette = { version = "7.6.0", features = ["derive", "fancy"] }
+21 -5
src/parser.rs
··· 2 2 use miette::{Diagnostic, SourceSpan}; 3 3 use std::fmt; 4 4 5 - #[derive(Debug, Diagnostic)] 5 + #[derive(Debug, Diagnostic, Clone)] 6 6 pub enum SyntaxError { 7 7 #[diagnostic(code(tachyon::syntax::missing_close))] 8 8 #[diagnostic(help("add a ']' to match this opening bracket"))] 9 - MissingClosingBracket { src: String, span: SourceSpan }, 9 + MissingClosingBracket { 10 + #[source_code] 11 + src: String, 12 + #[label("this bracket is never closed")] 13 + span: SourceSpan, 14 + }, 10 15 11 16 #[diagnostic(code(tachyon::syntax::missing_open))] 12 17 #[diagnostic(help("add a '[' to match this closing bracket"))] 13 - MissingOpenBracket { src: String, span: SourceSpan }, 18 + MissingOpenBracket { 19 + #[source_code] 20 + src: String, 21 + #[label("this bracket is never opened")] 22 + span: SourceSpan, 23 + }, 14 24 } 15 25 16 26 impl fmt::Display for SyntaxError { ··· 76 86 fn extra_closing_bracket() { 77 87 let source = "[]]"; 78 88 let result = parse_brackets(&tokenizer(source), source); 79 - eprintln!("{}", result.as_ref().unwrap_err()); 89 + eprintln!( 90 + "{:?}", 91 + miette::Report::new(result.as_ref().unwrap_err().clone()) 92 + ); 80 93 assert!(result.is_err()); 81 94 } 82 95 ··· 84 97 fn extra_opening_bracket() { 85 98 let source = "[[]"; 86 99 let result = parse_brackets(&tokenizer(source), source); 87 - eprintln!("{}", result.as_ref().unwrap_err()); 100 + eprintln!( 101 + "{:?}", 102 + miette::Report::new(result.as_ref().unwrap_err().clone()) 103 + ); 88 104 assert!(result.is_err()); 89 105 } 90 106 }