From 92c6f5ece0bd89698a5d4b11e8ea985e77197cdd Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sun, 28 Apr 2024 19:26:59 +0200 Subject: [PATCH] Adds a todo --- Todo.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Todo.md diff --git a/Todo.md b/Todo.md new file mode 100644 index 0000000..5d46061 --- /dev/null +++ b/Todo.md @@ -0,0 +1,79 @@ +# Current Tools +## TableGen + +# Todo +* Auto path (by default) +* Document + +## Tablegen +* Dissociate path from feature +* Force replace/ask +* Have interactive mode ? +* Dissociate Model from generation + +## Test Units + + + +# Futures tools +* Lexer/Checker + +## Lexer +` Command: grammar --check ` + +Tries to do a quick grammar check and locate errors + +* https://brunocalza.me/writing-a-simple-lexer-in-rust/ +* https://github.com/goffrie/plex + +### Logos, fast lexer + +* https://crates.io/crates/logos +```rust + use logos::Logos; + + #[derive(Logos, Debug, PartialEq)] + #[logos(skip r"[ \t\n\f]+")] // Ignore this regex pattern between tokens + enum Token { + // Tokens can be literal strings, of any length. + #[token("fast")] + Fast, + + #[token(".")] + Period, + + // Or regular expressions. + #[regex("[a-zA-Z]+")] + Text, + } +``` + + + +### Chumsky, full parser + +```rust +use chumsky::prelude::*; + +#[derive(Clone)] +enum Instr { + Left, Right, + Incr, Decr, + Read, Write, + Loop(Vec), +} + +fn parser() -> impl Parser, Error = Simple> { + 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()) +} +``` +