#syntax #text #inline #loc #block


Marktwin format support for Eternaltwin

5 unstable releases

new 0.5.0 Dec 3, 2023
0.4.2 Oct 28, 2021
0.4.1 Oct 26, 2021
0.4.0 Oct 26, 2021
0.3.0 Oct 18, 2021

#762 in WebAssembly

Download history 19/week @ 2023-08-12 11/week @ 2023-08-19 14/week @ 2023-08-26 31/week @ 2023-09-02 38/week @ 2023-09-09 10/week @ 2023-09-16 39/week @ 2023-09-23 58/week @ 2023-09-30 20/week @ 2023-10-07 16/week @ 2023-10-14 49/week @ 2023-10-21 46/week @ 2023-10-28 33/week @ 2023-11-04 25/week @ 2023-11-11 25/week @ 2023-11-18 39/week @ 2023-11-25

129 downloads per month
Used in 3 crates (via etwin_services)


2.5K SLoC

Marktwin parser

This library implements the Marktwin (mkt) parser used by Eternal-Twin. Marktwin is the format used by Eternal-Twin for its messages. It is inspired by Markdown and the Twinoid forum code. See the Marktwin library for more details.

The parser is implemented using Rust and compiled to Wasm. It is compatible with both Node and webpack.

All inputs produce valid parse trees, parsing cannot fail.


The parser uses a pipeline to gradually transform the input into a tree.

  1. Input: A string of valid unicode codepoints. It is up to the consumer to provide handle the encoding and provide this string.
  2. Context-free token stream: The lexer tokenizes the string only using the current index.
  3. Parse-event stream: Contains potentially remapped tokens end start/end events for nodes.
  4. Concrete Syntax Tree: Tree representation of the parse-event stream
  5. Abstract Syntax Tree: An adapter on top of the CST to provide easier access to the data.


The Rust implementation supports fuzzing:

cargo install cargo-fuzz
cargo fuzz run lexer
cargo fuzz run parser


~54K SLoC