| Crates.io | cow-parser |
| lib.rs | cow-parser |
| version | 0.1.1 |
| created_at | 2025-11-11 19:46:20.251366+00 |
| updated_at | 2025-11-13 10:14:48.500645+00 |
| description | A parser for the esoteric Cow programming language. |
| homepage | |
| repository | https://github.com/Dmilapko/cowHparser |
| max_upload_size | |
| id | 1928089 |
| size | 22,900 |
<https://crates.io/crates/cow-parser >
A parser for the esoteric Cow programming language, built in Rust using the pest library.
This parser processes text-based .cow files. It identifies and extracts the 12 valid Cow commands (MoO, moO, etc.) while ignoring all other text, which is treated as comments. The result of a successful parse is an Abstract Syntax Tree (AST), represented by a sequence of pest pairs, where each pair corresponds to a recognized command. This AST can then be used as input for an interpreter or a compiler.
The parsing logic is defined by the following rules:
command = {
moo | mOo | moO | mOO | Moo | MOo | MoO | MOO | OOO | MMM | OOM | oom
}
moo = { "moo" }
mOo = { "mOo" }
moO = { "moO" }
mOO = { "mOO" }
Moo = { "Moo" }
MOo = { "MOo" }
MoO = { "MoO" }
MOO = { "MOO" }
OOO = { "OOO" }
MMM = { "MMM" }
OOM = { "OOM" }
oom = { "oom" }
program = _{ SOI ~ (command | ANY)* ~ EOI }